记录编号 |
101034 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2010冲刺五]无穷的序列 |
最终得分 |
100 |
用户昵称 |
Bokjan |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
1.395 s |
提交时间 |
2014-05-09 19:07:54 |
内存使用 |
119.50 MiB |
显示代码纯文本
#include<cstdio>
struct BitArray{
bool a1:1;
bool a2:1;
bool a3:1;
bool a4:1;
bool a5:1;
bool a6:1;
bool a7:1;
bool a8:1;
};
BitArray b[125000010]={0};
const int max=1000000000;
int main(void){
freopen("unlessseq.in","r",stdin);
freopen("unlessseq.out","w",stdout);
int n,in;
b[0].a1=1;
b[0].a2=1;
b[0].a3=0;
b[0].a4=1;
b[0].a5=0;
b[0].a6=0;
b[0].a7=1;
b[0].a8=0;
for(int i=11,j=4;i<max;j++){
int im8=i%8;
if(!im8)
b[i/8-1].a8=1;
else
switch(im8){
case 1:
b[i/8].a1=1;
break;
case 2:
b[i/8].a2=1;
break;
case 3:
b[i/8].a3=1;
break;
case 4:
b[i/8].a4=1;
break;
case 5:
b[i/8].a5=1;
break;
case 6:
b[i/8].a6=1;
break;
case 7:
b[i/8].a7=1;
break;
}
i+=(j+1);
}
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&in);
int im8=in%8;
if(!im8)
printf("%d\n",b[in/8-1].a8);
else
switch(im8){
case 1:
printf("%d\n",b[in/8].a1);
break;
case 2:
printf("%d\n",b[in/8].a2);
break;
case 3:
printf("%d\n",b[in/8].a3);
break;
case 4:
printf("%d\n",b[in/8].a4);
break;
case 5:
printf("%d\n",b[in/8].a5);
break;
case 6:
printf("%d\n",b[in/8].a6);
break;
case 7:
printf("%d\n",b[in/8].a7);
break;
}
}
return 0;
}