2 3
Yes No
#include<stdio.h> int f[35]={0,3,7}; int prime(int x) { int k; for(k=2;k<x;k++) if(x%k==0) return 0; return 1; } int main() { int i,j; int m; for(i=3;i<35;i++) f[i]=f[i-1]+f[i-2]; while(scanf("%d",&m)&&m!=-1)//&&m!=-1和!=EOF不一样吗? { if(prime(f[m])) printf("Yes\n"); else printf("No\n"); } return 0; }
NYOJ 480 Fibonacci Again!,布布扣,bubuko.com
原文地址:http://blog.csdn.net/qq_16767427/article/details/38074793