标签:can stream ret eve ring hid str hdu bdc
1020
1021 Fibonacci again
问题重述:F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2);给定一系列n,求f(n)是否被3整除;
思路:硬算,暴力求解;
正确思路:找规律,发现n%4==2那么就可以被f(n)就可以被3整除;
1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <iostream> 5 using namespace std; 6 int main() { 7 int n; 8 while(~scanf("%d",&n)){ 9 if(n%4==2)puts("yes"); 10 else puts("no"); 11 } 12 return 0; 13 }
标签:can stream ret eve ring hid str hdu bdc
原文地址:https://www.cnblogs.com/yidiandianwy/p/11593578.html