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 1209. 1, 10, 100, 1000...

write out the answer cost me too much time,I use pascal,who can help me?
Posted by lz 5 Jul 2003 17:33
Re: this is my short solution
Posted by ACer 6 Jul 2003 18:15
var j,n,i:longint;
    t,l:extended;

begin
     read(n);
     for i:=1 to n do
     begin
          read(j);
          l:=j-1;
          l:=l*2;
          t:=trunc(sqrt(l));
          t:=t*(t+1)/2;
          if  (t>=j-1)and(abs(t-j+1)<=1e-6) then writeln(1)
                                        else writeln(0);
          end;
end.