/*
@author:Unibrighter
@problem:HDU 1021 Fibonacci Again
@idea:change this Fibonacci array into an array of mod 3.
@see:
fn: 7 11 18 29 47 76 ...
index: 0 1 2 3 4 5 ...
mod: 1 2 0 2 2 1 ...
*/
#include <fstream>
#include <iostream>
using namespace std;
int
main()
{
#ifndef ONLINE_JUDGE
ifstream cin("./IN1021.TXT");
#endif
int n=0,result=0;
while(cin>>n)//get the input of n
{
int f0=7%3;
int f1=11%3;
//cout<<"the value of n:"<<n<<endl;
if(n==0||n==1)
{
cout<<"no"<<endl;
continue;
}
n--;
while(n--)
{
result=(f0+f1)%3;
f0=f1;
f1=result;
//cout<<"now that result :"<<result<<endl;
}
if(!result)cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}
无技术含量,直接水过...不过知道了hdu oj里面的GCC是gnu c compiler,而非gnu complier collection.一开始选gcc报CE...