WRONG ANSWER
BECCA · 2014-02-05 18:21:03
Hello,
I wrote the code for this problem. And also I get correct answer when I try with the question's test cases and the test cases from Sarv 123
But I always get WRONG ANSWER. Here is my code:
#include <iostream>
#include <cmath>
using namespace std;
unsigned long long array[1000][1000] = { { 0 } };
unsigned long long M(int H, int T){
if (array[H][T]) return array[H][T];
for (int i = 0; i <= H; ++i){
for (int j = 0; j <= T; ++j){
if (i == 0) array[i][j] = j;
else if (i + 1 > j) array[i][j] = pow(2, j) - 1;
else array[i][j] = array[i - 1][j - 1] + array[i][j - 1] + 1;
}
}
return array[H][T];
}
int main(){
int H, T;
while (cin >> T >> H, H || T)
cout << (M(H, T) + 1) % 1000000007 << endl;
}
Am I doing something wrong? What's the problem?
Thank You ♥
BECCA · 2014-03-05 14:01:16
Guys please help me. I tried almost everything but I get Wrong Answer everytime. What's wrong with the code above????
pages:
- 1