No older revisions available
No older revisions available
소감 ¶
2006-01-10 Accepted 0.057 Minimum |
코드 ¶
~cpp // 10198 - Counting #include "BigInteger.h" using BigMath::BigInteger; #define MAX_SIZE 1000 static BigInteger Tn[MAX_SIZE+1]; void preCalc() { Tn[0] = 1; Tn[1] = 2; Tn[2] = 5; for (int i = 3; i <= MAX_SIZE; i++) Tn[i] = 2 * Tn[i-1] + Tn[i-2] + Tn[i-3]; } int main() { int n; preCalc(); while (cin >> n) cout << Tn[n] << endl; return 0; }