2C. Fibonacci Again
2C. Fibonacci Again
1000ms
1000ms
32768KB
64-bit integer IO format: %I64d Java class name: Main
There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).
View Code
Input
Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000).
Output
Print the word "yes" if 3 divide evenly into F(n).
Print the word "no" if not.
Print the word "no" if not.
Sample Input
0 1 2 3 4 5
Sample Output
no no yes no no no
规律是:no no yes no
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cstdlib> 5 #include <vector> 6 #include <climits> 7 #include <algorithm> 8 #include <cmath> 9 #define LL long long 10 using namespace std; 11 int main(){ 12 int n; 13 while(~scanf("%d",&n)){ 14 n%4 == 2 ? puts("yes"):puts("no"); 15 } 16 return 0; 17 }
夜空中最亮的星,照亮我前行

浙公网安备 33010602011771号