Very simple solution HERE!

const eps=0.000001;

var i,n:word; a,b:real;

begin

readln(n);

for i:=1 to n do begin

readln(b);

a:=(sqrt(8*b-7)-1)/2;

if (frac(a)<eps) or (frac(a)>1-eps) then write('1 ')

else write('0 ');

end;

end.

Re: Very simple solution HERE!

Thank you very much!

Re: Very simple solution HERE!

Posted by

HuyBui 18 Dec 2017 07:55

Can anyone explain how does it give the right answers?

Re: Very simple solution HERE!

can you please explain the logic of the problem?