Description defines a sequence: f [0] = 0, f [1] = 1, f [n] = f [n-1] + f [N-2]. So what is f [10] and f [100]? What is f [1000... the final result of the simulation is obviously very large. Now, as long as you output the last four digits of f [n], the previous 0 will not be output. If the answer is 10000, the output is 0. If the answer is 10001, output 1.0 ≤ n ≤ 1,000,000,000 Input Multiple groups of data, the last four pieces of Sample Input4Sample Output3HintSourceLLL in each group of nOutputf [n] See mod = 10000 and there are 1000000000 pieces of data, so there must be duplicates. If f (n) = f (1) & f (n-1) = f (0). At this time, the loop section finds the result as 15000, as if [cpp] # include <iostream> # include <cstdio> using namespace std; int a [30001]; int main () {int n; a [0] = 0; a [1] = 1; (Int I = 2; I <= 30000; I ++) a [I] = (a [I-1] % 10000 + a [I-2] % 10000) % 10000; while (scanf ("% d", & n )! = EOF) {if (n <= 30000) printf ("% d \ n", a [n]); else printf ("% d \ n ", a [n % 30000]);} return 0 ;}