NEFU 115
刚开始,做了水题
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ int n; int a31,a32,a41,a42,a121,a122,ans3,ans4,ans12; while(scanf("%d",&n)!=EOF){ a31=a32=a41=a42=a121=a122=1; for(int i=3;i<=n;i++){ ans3=(a31+a32)%3; ans4=(a41+a42)%4; ans12=(a121+a122)%12; a31=a32; a32=ans3; a41=a42; a42=ans4; a121=a122; a122=ans12; } if(ans12==0) printf("YES\n"); else if(ans4==0) printf("4\n"); else if(ans3==0) printf("3\n"); else printf("NO\n"); } return 0; }