|  | 
|  | 
| вернуться в форум | WA#1 Who can find an error in my prog? =) I didn't use any long arithmethic but i think it should passes the first test. But judge says WA !!! Help please if you can
 
 #include <iostream>
 
 using namespace std;
 
 long long d[10001][2];
 
 int main () {
 int n, k;
 
 cin >> n >> k;
 
 d[0][0] = 1;
 d[0][1] = 0;
 
 int i, j;
 
 for (i = 1; i <= n; ++i) {
 
 d[i][1] = 0;
 for (j = 1; j <= k; ++j) {
 if (n - j < 0)
 continue;
 
 d[i][1] += d[i - j][0];
 }
 
 d[i][0] = d[i - 1][0] + d[i - 1][1];
 }
 
 cout << d[n][0] + d[n][1];
 
 return 0;
 }
 | 
 | 
|