|
|
back to boardHELP!!! Crash (floating-point invalid operation) #3 test..... Posted by Swifty 17 Mar 2009 19:45 Here is my code. Can't understand my mistake. var i,n,k:word; m:real; begin readln(n); for i:=1 to n do begin readln(k); m:=(sqrt(8*k-7)-1)/2; if (frac(m))=0.0 then write('1 ') else write('0 '); end; readln; end. Re: HELP!!! Crash (floating-point invalid operation) #3 test..... So did I. But I am AC now. ----------------------------------------------- program p1196; var i,n:longint; a,b:qword; //point begin readln(n); for i:=1 to n do begin readln(a); b:=trunc(sqrt((a-1)*2)); if (a-1)*2=b*(b+1) then write(1,' ') else write(0,' '); end; end. |
|
|