/*
此题纠结了n久
感觉自己的方法应该是最高效的解法了
但每次提交都超时
后来发现原来是上界弄错了
无语。。。
*/
#define LOCAL
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
#ifdef LOCAL
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int n,first=1;double k;unsigned long t;
cin>>n;
while(n--){
cin>>k;
t=(long)sqrt(2*k);//就是这得上界弄错了
while((t*(t+1))>(2*(k-1))) t-=1;
if((t*(t+1))==(2*(k-1)))
{if(first){cout<<1;first=0;}
else{cout<<" 1";}}
else{if(first){cout<<0;first=0;}
else{cout<<" 0";}}}
cout<<endl;
return 0;
}
URAL 1209 110100100010000……
最新推荐文章于 2024-03-31 11:14:36 发布