No, the data maynot be saved as buffer and print it at time.

I wrote it by pascal. It can pass. But C doesn't.

Code:

var t:int64;
n,j:longint;
begin
readln(n);
for j:=1 to n do
begin
readln(t);
if trunc(sqrt(1+4*2*(t-1)))=sqrt(1+4*2*(t-1)) then
begin
if j<>n then write('1',' ') else write('1');
end
else
begin
if j<>n then write('0',' ') else write('0');
end;
end;
end.

C code

Code:

#include <stdio.h>
#include <math.h>
int main()
{
long i, n;
unsigned long long x, k;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%lld", &x);
k = sqrt(8*x-7);
if (k == sqrt(8*x-7))
printf("1");
else
printf("0");
if (i != n) printf(" ");
}
return 0;
}