tag: OS Io for SP on c AMP IOS r
// A [n] = A [n-1] + A [N-2] + A [n-3] + A [n-4]; # include <stdio. h> # include <algorithm> # include <string. h ># include <iostream> using namespace STD; int A [10000] [260] = {0}; // each element can store 8 digits, therefore, 2005 bits can be stored with 260 array elements. Int main () {int I, j, N; A [1] [0] = 1; A [2] [0] = 1; A [3] [0] = 1; A [4] [0] = 1; for (I = 5; I <10000; I ++) {for (j = 0; j <260; j ++) A [I] [J] + = A [I-1] [J] + A [I-2] [J] + A [I-3] [J] + A [I-4] [J]; for (j = 0; j <260; j ++) {if (a [I] [J]> 100000000) {A [I] [J + 1] + = A [I] [J]/100000000; A [I] [J] = A [I] [J] % 100000000 ;}} while (~ Scanf ("% d", & N) {for (j = 259; j> = 0; j --) if (a [n] [J]) break; printf ("% d", a [n] [J]); // For (j = J-1; j> = 0; j --) printf ("% 08d ", a [n] [J]); printf ("\ n");} return 0 ;}
HDU 1250 hat's Fibonacci (large number addition)