|
|
back to boardWho know where is my mistake var a,b:array[1..1000000] of integer; f:array[1..1000000]of integer; n,v,e,k,u:integer; begin k:=0; assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); readln(n); for v:=1 to n do begin read(a[v]); read(b[v]); readln end; for e:=n downto 1 do begin f[e]:=a[e]+b[e]; f[e]:=f[e]+k; if f[e]>9 then begin f[e]:=f[e]-10; k:=1; end else k:=0; if((e=1)and(f[e]>9)) then f[e]:=f[e]+10; end; for u:=1 to n do write(f[u]); end. Re: Who know where is my mistake var a,b:array[1..1000000] of integer; f:array[1..1000000]of integer; n,v,e,k,u:integer; begin k:=0; readln(n); for v:=1 to n do begin read(a[v]); readln(b[v]); end; for e:=n downto 1 do begin f[e]:=a[e]+b[e]; f[e]:=f[e]+k; if f[e]>9 then begin f[e]:=f[e]-10; k:=1; end else k:=0; if((e=1)and(f[e]>9)) then f[e]:=f[e]+10; end; for u:=1 to n do write(f[u]); end. You shouldn't using input,output in your solution. But i can't find your mistake too... Edited by author 24.05.2011 23:51 Edited by author 24.05.2011 23:52 Re: Who know where is my mistake Posted by Stepan 17 Nov 2013 15:14 if((e=1)and(f[e]>9)) then f[e]:=f[e]+10; f[e]>9... Why do you plus 10? Sorry, I am Russian. |
|
|