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 1087. The Time to Take Stones

What ir wrong???Could someone give me extrea tests,please??
Posted by Vladimir Milenov Vasilev 16 Jan 2002 20:25
Here is my program, if you can, give me some extra tests. Thank you!!!

program The_time;
var a:array[0..10000] of byte;
    st : array[1..50] of longint;
    n,k,i,j : integer;
    bool:boolean;
Begin
readln(n,k);
for i:=1 to k do read(st[i]);
a[0]:=1;
for i:=1 to n do a[i]:=0;
for i:=1 to n do
 Begin
  bool:=false;
  for j:=1 to k do
  if i-st[j]>=0
  then if a[i-st[j]]=2
       then
        Begin
         a[i]:=1;
         break;
        End
       else if a[i-st[j]]=1
            then if bool=false
                 then bool:=true;
  if(bool)and(a[i]=0) then a[i]:=2;
 End;
writeln(a[n]);
End.