define和printf的输出冲突了,~~建议使用快输进行输出~~
by HGJH°L @ 2021-09-30 14:13:06
@[HGJH°L](/user/68574) 然而,还是不行...╮(╯﹏╰)╭
```
#include<bits/stdc++.h>
//#include<windows.h>
using namespace std;
long long f[30][30][30],k=0;
void print(long long a,long long b,long long c){
cout<<a<<" "<<b<<" "<<c<<" "<<++k<<endl;
//if(k>=100)Sleep(1000);
}
long long w(long long a,long long b,long long c){
//print(a,b,c);
if(a<=0||b<=0||c<=0)return 1;
if(f[a][b][c]){
//cout<<a<<" "<<b<<" "<<c<<" "<<f[a][b][c]<<endl;
return f[a][b][c];
}
if(a<b&&b<c)f[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
else f[a][b][c]=w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1);
}
int main(){
long long a,b,c;
f[0][0][0]=1;
while(cin>>a>>b>>c&&a!=-1||b!=-1||c!=-1){
printf("w(%lld, %lld, %lld) = ",a,b,c);
if(a<=0||b<=0||c<=0)a=0,b=0,c=0;
else if(a>20||b>20||c>20)a=20,b=20,c=20;
w(a,b,c);
printf("%lld\n",f[a][b][c]);
}
return 0;
}
```
by __凉皮__ @ 2021-09-30 14:17:54
@[__凉皮__](/user/259944) 估计是没有返回值
你可以看看这份代码
```cpp
// luogu-judger-enable-o2
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define ll long long
#define il inline
using namespace std;
ll f[30][30][30];
ll w(long long a, long long b, long long c)
{
return ((a<=0||b<=0||c<=0)?1:((a>20||b>20||c>20)?w(20,20,20):((f[a][b][c]==0)?(f[a][b][c]=((a<b&&b<c)?(w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c)):(w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1)))):f[a][b][c])));
}
signed main()
{
long long a,b,c;
while (1)
{
read(a,b,c);
if (a!=-1||b!=-1||c!=-1)
printf("w(%lld, %lld, %lld) = %d\n",a,b,c,w(a,b,c));
else
break;
}
return 0;
}
```
by HGJH°L @ 2021-09-30 14:40:10
@[__凉皮__](/user/259944) 你的这份改完后是这样的
```cpp
#include<bits/stdc++.h>
//#include<windows.h>
using namespace std;
long long f[30][30][30],k=0;
void print(long long a,long long b,long long c){
cout<<a<<" "<<b<<" "<<c<<" "<<++k<<endl;
//if(k>=100)Sleep(1000);
}
long long w(long long a,long long b,long long c){
//print(a,b,c);
if(a<=0||b<=0||c<=0)return 1;
if(!f[a][b][c]){
if(a<b&&b<c) f[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
else f[a][b][c]=w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1);
}
return f[a][b][c];
}
int main(){
long long a,b,c;
f[0][0][0]=1;
while(cin>>a>>b>>c&&a!=-1||b!=-1||c!=-1){
printf("w(%lld, %lld, %lld) = ",a,b,c);
if (a<=0||b<=0||c<=0)
a=0,b=0,c=0;
else if (a>20||b>20||c>20)
a=20,b=20,c=20;
printf("%lld\n",w(a,b,c));
}
return 0;
}
```
by HGJH°L @ 2021-09-30 14:42:53
@[HGJH°L](/user/68574) A了,谢谢!Thanks♪(・ω・)ノ
~~到现在才看到,都快把这个题忘了...~~
by __凉皮__ @ 2021-10-04 00:06:54
@[__凉皮__](/user/259944) 没事
by HGJH°L @ 2021-10-04 11:25:05
《新人求助,function那道题,本地AC交RE》
by syanoeclipse @ 2021-10-12 20:26:31