杭电1021

此题还是一道规律题,不能直接算!!!否则将超时!!呵呵!
先观察计算出前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;
}

原文地址:https://www.cnblogs.com/xiohao/p/2755605.html