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 1248. Sequence Sum

Why "Compilation error"
Posted by Demelition 13 Sep 2006 21:10
{$N+}
program a1;
var i,j,n,pl:word;
    s,sum:Extended;
    res:string;
    fl,fl2:boolean;
begin
read(n);
read(s);
sum:=s;
for i:=1 to n-1 do
  begin
    read(s);
    sum:=sum+s;
  end;
str(sum,res);
n:=length(res);
fl:=false;
fl2:=true;
for i:=1 to n do
  begin
    if res[i]='E' then
      begin
        res[i]:='e';
        pl:=i;
        fl:=true;
      end;
    if (fl=true){ and (fl2=true)} and (res[pl+1]='0') or (res[i]='+') then
      begin
        i:=i-1;
        fl2:=false;
        for j:=pl+1 to n do
          begin
            res[j]:=res[j+1];
            if res[j]<>'0' then fl2:=false;
          end;
      end;
  end;
for i:=1 to length(res)-1 do res[i]:=res[i+1];
write(res);

end.
Re: Why "Compilation error"
Posted by KIRILL 14 Sep 2006 19:19
Because of you try to change variable i , used  for  cycle  For