此题还是一道规律题,不能直接算!!!否则将超时!!呵呵!
先观察计算出前30项如下:
1 2 0 2 2 1 0 1 1 2 0 2 2 1 0 1.......规律出来了!哈!
那还等什么,直接ac掉!!!
#include<iostream>
using namespace std;
int main()
{
int n,i,a[]={1,2,0,2,2,1,0,1};
while(cin>>n)
{
i=n%8;
if(a[i]==0)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return 0;
}
杭电1021
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:杭电2091
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章