题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1021
题目大意:首两项为7,11的斐波那契数列。若第n项能被3整除,输出yes,否则输出no
关键思想:模三加法情况有限,找规律。
代码如下:
#include <iostream>
using namespace std;
int main(){
int n;
while(cin>>n)
if(n%8==2||n%8==6)cout<<"yes"<<endl;
else cout<<"no"<<endl;
return 0;
}
原文:http://www.cnblogs.com/G-M-WuJieMatrix/p/6363422.html