难道是巧合吗? 我这样做的时候刚开始是对9取模,但是不通过,最后改成了8直接AC
#include <iostream>
using namespace std;
int main(){
int f[10];
int n;
while(cin>>n){
f[0]=7%3;
f[1]=11%3;
for(int i=2;i<9;i++){
f[i]=(f[i-1]+f[i-2])%3;
}
if(f[n%8]==0)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return 0;
}