题目:http://acm.hdu.edu.cn/showproblem.php?pid=1021
代码:
#include <iostream>
using namespace std;
int res[1000002];
int main()
{
res[0] = 7;
res[1] = 11;
int n,i;
int max = 2;
while(cin>>n)
{
if(res[n] == 0)
{
for(i=max; i<=n; i++)
{
res[i] = (res[i-1] + res[i-2])%3;
}
}
max = n+1;
if(res[n]%3)
{
cout<<"no"<<endl;
}
else
{
cout<<"yes"<<endl;
}
}
return 0;
}