Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
问一下:这道题若要硬算出必败数列中的每一项,则必超时?可以不代公式么? 这个程序对么? program pku1067; const max=15000; var a,b,c,d,i,j:longint; f:array[0..max] of longint; begin while not seekeof(input) do begin fillchar(f,sizeof(f),0); readln(a,b); if a>b then begin c:=a; a:=b; b:=c; end; f[1]:=1; c:=1; d:=1; i:=1; j:=1; while (f[c]<a)and(c<b-a) do begin while f[i]=d do begin i:=i+1; d:=d+1; end; while f[j]+j=d do begin j:=j+1; d:=d+1; end; c:=c+1; f[c]:=d; end; if (f[c]=a)and(f[c]+c=b) then writeln('0') else writeln('1'); end; end. 就是硬产生必败数列中的每一项,若不在这个数列中的,则为必胜? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator