|
|
вернуться в форумIt's easy. Look at me const Inf ='1100.in'; max =150000; var num :array[1..max] of longint; n :longint; procedure into; var i,a,b :longint; begin assign(input,Inf); reset(input); readln(n); if n=0 then halt; for i:=1 to n do begin readln(a,b); num[i]:=a*1000+b; end; close(input); end; procedure workout; var i,j,max, Tmax :longint; begin for i:=100 downto 1 do for j:=1 to n do if num[j] mod 1000=i then writeln(num[j] div 1000,' ',num[j] mod 1000); end; begin into; workout; end. But incorrect (-) > const > Inf ='1100.in'; > max =150000; > var > num :array[1..max] of longint; > n :longint; > > procedure into; > var > i,a,b :longint; > begin > assign(input,Inf); reset(input); > readln(n); > if n=0 then halt; > for i:=1 to n do > begin > readln(a,b); > num[i]:=a*1000+b; > end; > close(input); > end; > > procedure workout; > var > i,j,max, > Tmax :longint; > begin > for i:=100 downto 1 do > for j:=1 to n do > if num[j] mod 1000=i then writeln(num[j] div 1000,' ',num[j] > mod 1000); > end; > > begin > into; > workout; > end. Re: It's easy. Look at me > const > Inf ='1100.in'; > max =150000; > var > num :array[1..max] of longint; > n :longint; > > procedure into; > var > i,a,b :longint; > begin > assign(input,Inf); reset(input); > readln(n); > if n=0 then halt; > for i:=1 to n do > begin > readln(a,b); > num[i]:=a*1000+b; > end; > close(input); > end; > > procedure workout; > var > i,j,max, > Tmax :longint; > begin > for i:=100 downto 1 do > for j:=1 to n do > if num[j] mod 1000=i then writeln(num[j] div 1000,' ',num[j] > mod 1000); > end; > > begin > into; > workout; > end. a small mistake you should write for I := 100 downto "0" instead of "1" You have too many variables that you never used. Aidin |
|
|