ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

WA на первом тесте pascalABC. Что не так ? *HELP*
Posted by Kety Pirozhkova 28 Nov 2018 21:20
скорее всего ошибка с функцией Eof() ибо впервые ей пользуюсь и смутно представлю принцип работы. Если её нельзя использовать, то как найти конец вводимого файла?

var s,sk:string;
var i,fl,j,code:integer;
var n:real;
var a:array [1 ..256] of real;
var f:array [1 ..256] of integer;
begin
while (Eof()<>True ) do
 begin
 readln(s);
 for i:=1 to length(s) do
 begin
 if (s[i]<>' ') and (fl=0) then begin
                               fl:=1;
                               sk:=sk+s[i];
                               end
else  if (s[i]<>' ') and (fl=1) then sk:=sk+s[i];

 if (((s[i]=' ') and (fl=1)))or ((i=length(s))and(fl=1)) then begin
                                 fl:=0;
                                 val(sk,n,code);
                                 for j:=1 to 256 do
                                 if f[j]<>1 then begin
                                                 a[j]:=sqrt(n);
                                                 f[j]:=1;
                                                 sk:='';
                                                 n:=0;
                                                 break;
                                                 end;

                                 end;
 end;end;
for i:=1 to 256 do
if (f[i]=1) then writeln(a[i]:0:4);
end.