Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 贴个c++代码 h=10,w=11时答案是3852472573499

Posted by a280920481 at 2018-11-27 20:59:52 on Problem 2411 and last updated at 2018-11-27 21:05:47
```#include <iostream>
using namespace std;

long long dp[2][2048];

int main()
{
int h, w;
long long res;
bool n;

while (true)
{
cin >> h >> w;
if (!h)
{
break;
}

n = false;
for (int i = 0; i < 2048; i++)
{
dp[0][i] = 0;
dp[1][i] = 0;
}

dp[n][0] = 1;

for (int i = h - 1; i >= 0; i--)
{
for (int j = w - 1; j >= 0; j--)
{
for (int u = 0; u < (1 << w); u++)
{
res = 0;
if ((u >> j) & true)
{
res = dp[n][u & (~(1 << j))];
}
else
{
if (j + 1 < w && !((u >> (j + 1)) & true))
{
res += dp[n][u | (1 << (j + 1))];
}
if (i + 1 < h)
{
res += dp[n][u | (1 << j)];
}
}
dp[!n][u] = res;
}
n = !n;
}
}
cout << dp[n][0] << '\n';
}
return 0;
}

```

Followed by: