HDOJ 1021 水题

来源:互联网 发布:什么矩阵可以lu分解 编辑:程序博客网 时间:2024/06/07 21:53

第一看上去是个打表,先写了再说(虽然我感觉应该不是这样。)然后特么过了。。又是水题

#include <iostream>#include <string.h>using namespace std ;typedef long long ll;const int MAX =1000050;ll f[MAX]={7,11};int main(){    for(int i = 2 ; i <= 1000000 ; i++){        f[i]=f[i-1]%3+f[i-2]%3;    }    int n ;    while(cin>>n){        if(f[n]%3==0)   cout<<"yes"<<endl;        else cout <<"no"<<endl;    }    return 0;}
原创粉丝点击