水。
#include <cstdio> #include <cmath> bool f(int n){ int t = (int)sqrt(n); for(int i = 2; i <= t; ++i) if(n % i == 0) return 0; return 1; } int main(){ int a[30] = {0, 3, 7}, i; for(i = 3; i != 30; ++i) a[i] = a[i - 1] + a[i - 2]; while(scanf("%d", &i), i != -1) printf(f(a[i]) == 0 ? "No\n" : "Yes\n"); return 0; }
原文:http://blog.csdn.net/chang_mu/article/details/19704633