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 1191. Catch the thief!

I have WA#10. Can you help me?
Posted by Max Pilgrim 18 Mar 2009 19:38
I have WA#10. Can you help me?
here is my code:
program _1191;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var   k:array[1..100]of longint;
l,n,i,q,z:longint;
begin
reset(input,'input.txt');
 rewrite(output,'ouput.txt');
  read(l,n);
  q:=1;
  z:=0;
  for i:=1 to n do
    begin
     read(k[i]);
     z:=z+k[i];
     if l<z then
        begin
          write('YES');
          halt(0);
        end
     else
      while l>z+q*k[i] do
        inc(q);
      l:=z+q*k[i];
        q:=1;
    end;
   write('NO');
end.

Edited by author 18.03.2009 19:38