|
|
back to boardGive me some good test, please! I gov WA! const MAXN = 10000; var N,M,i,j,min:integer; K:array[1..100]of integer; a:array[1..MAXN]of byte; begin readln(N,M); for i:=1 to M do begin read(K[i]); end; for i:=1 to N do a[i]:=2; min:=MaxInt; for i:=1 to M do if min > k[i] then min:=k[i]; a[min]:=0; for i:=min+1 to N do begin for j:=1 to M do if (i-K[j]>0)and(a[i-K[j]]<>2) then begin if a[i-K[j]] = 0 then begin a[i]:=1; break; end else a[i]:=0; end; end; if a[N] = 0 then writeln(2) else writeln(1); end. A test for you(+) Try this test: 117 2 15 17 Correct answer is 1 Thank's you vety much! Now I got AC! Re: A test for you(+) > Try this test: > 117 2 > 15 17 > Correct answer is 1 But, 117 = 15*1+17*6; so the first person will take four times and the second one three times. This implies that the first one must be taking the last stone. |
|
|