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 1247. Check a Sequence

My program is wrong !!!??? But I think it is right??
Posted by Aleksey S.S. 13 Apr 2003 22:23
Help me please!!!
-------------------------------------
var s,n,sum,i,j,k,a:longint;
procedure solve(i:integer);
var j:integer;
begin
 for j:=i to s do readln;
end;

begin
 readln(s,n); k:=0;
 for i:=1 to s do begin
  read(a); inc(k);
  if a<>0 then sum:=sum+a
  else begin
   if sum>k+n then begin solve(i); write('No'); halt; end
    else
   if sum<k then begin sum:=0; k:=0; end
  end;
 end;
 if sum>k+n then write('No') else write('Yes');
end.
----------------------------------
Thank you!!!
Wrong solution (+)
Posted by uuuuuuu 13 Apr 2003 23:48
Just think when it is most likely the inequality won't be true ! When
You realize it You'll get AC !