NYOJ 527 AC_mm dota
AC_mm dota play time limit: 1000 MS | memory limit: 65535 KB difficulty: 2
-
Description
-
As we all know, AC_mm prefers to play games, especially the classic game war3. One day AC_mm came to the vsplatform and was about to abuse cainiao. It happened that we abused our ACM Captain ^_^, and our captain was unhappy, it is said that a difficult problem is required to embarrass AC_mm. This is the description of the question. To give a positive integer n, n has a 1 and B 0 in binary representation (excluding leading 0 and sign bit, evaluate the value ans of the nth * B of the Fibonacci series after the modulo of 1314520.
Note (Fibonacci sequence: f [0] = 1, f [1] = 1; f [n] = f [n-1] + f [N-2]; n> = 2 ;)
-
Input
-
Input: there are multiple groups of test data, enter a positive integer n (n <1000000000 );
-
Output
-
Output: ans Value
-
Sample Input
-
126
-
Sample output
-
52
The idea of this question is simple. The key is to take binary, convert, and obtain x * y, and obtain the remainder when the table is typed.
# Include
Int a [260]; int s [40]; int shift1 (int n) {int num = 1, I; s [0] = n % 2; while (n/2! = 0) {n/= 2; s [num ++] = n % 2;} int t; for (I = 0; I <= num/2; I ++) // here num/2 do not write num {t = s [I]; s [I] = s [num-1-i]; s [num-1-i] = t ;} int x = 0, y = 0; for (I = 0; I
There must be a problem with the back-end database on NYOJ. You can leave the remainder when you do not create a table !!!