猜您想说:全 **[TLE](https://www.luogu.com.cn/record/101331043)** 了
by User_Unauthorized @ 2023-02-03 17:40:00
@[devcjj](/user/829643)
要记忆化
by heike305 @ 2023-02-03 17:54:03
@[heike305](/user/789739) 我用了记忆化了呀
by devcjj @ 2023-02-03 19:18:42
@[devcjj](/user/829643) 用的C?
by heike305 @ 2023-02-03 20:04:51
@[heike305](/user/789739) C++
by devcjj @ 2023-02-03 20:05:46
@[devcjj](/user/829643)
这个程序一直在输入,建议把
```
while (a != -1 && b != -1 && c != -1)
{
cin >> a >> b >> c;
if (a <= 0 || b <= 0 || c <= 0)
{
cout << "w(" << a << "," << b << "," << c << ")=" << "1" << endl;
}
else
{
if (a > 20 || b > 20 || c > 20)
{
dfs(20, 20, 20);
cout << "w(" << a << ", " << b << ", " << c << ") = " << shu[20][20][20] << endl;
}
else {
dfs(a, b, c);
cout << "w(" << a << ", " << b << ", " << c << ") = " << shu[a][b][c] << endl;
}
}
a = 0, b = 0, c = 0;
}
```
换成
```cpp
while (1)
{
cin >> a >> b >> c;
if(a < 0 && b < 0 && c < 0)
{
break;
}
if (a <= 0 || b <= 0 || c <= 0)
{
cout << "w(" << a << "," << b << "," << c << ")=" << "1" << endl;
}
else
{
if (a > 20 || b > 20 || c > 20)
{
dfs(20, 20, 20);
cout << "w(" << a << ", " << b << ", " << c << ") = " << shu[20][20][20] << endl;
}
else {
dfs(a, b, c);
cout << "w(" << a << ", " << b << ", " << c << ") = " << shu[a][b][c] << endl;
}
}
}
```
还有,你这个程序没过样例,建议先自己测过样例还过不了才发帖求助。
by heike305 @ 2023-02-03 20:20:36
@[heike305](/user/789739)
我天!没过样例,真不好意思,我改了代码,忘了检查样例了,谢谢您
by devcjj @ 2023-02-03 21:16:38
额。。。
by DBL_MAX @ 2023-06-03 20:01:05