|
|
back to boardHelp! My program got time limited! Posted by Tang RZ 29 May 2004 14:53 This is my program: var a:array [1..10000] of longint; flag,pd:boolean; one,k,n,jia:longint; procedure work(k:longint;pd:boolean); var t:longint; i:integer; begin flag:=true; jia:=0; t:=0; if k<>1 then repeat inc(jia); t:=t+jia; until k-t<jia+1 else flag:=false; if k-t=1 then flag:=false; if flag then write('0') else write('1'); if pd=false then write(' ') else writeln; end; procedure init; var i:integer; begin read(n); for i:=1 to n do begin read(k); if i<>n then pd:=false else pd:=true; work(k,pd); end; end; begin init; end. |
|
|