答案全对,但是全WA,求大佬指导

P1464 Function

输出应该有空格叭 QAQ 还有测了样例 `-1 -1 -1` 后还有输出 ing
by maoyiting @ 2021-02-20 15:41:26


@[迟陌](/user/160870) ``` #include<iostream> #include<cstdio> #include<cstring> using namespace std; long long f[25][25][25]; long long fun(long long a,long long b,long long c) { if(f[a][b][c]!=-1) return f[a][b][c]; else { if(a<=0||b<=0||c<=0) return 1; else if(a>20||b>20||c>20) return f[a][b][c]=fun(20,20,20); else if(a<b&&b<c) return f[a][b][c]=fun(a,b,c-1)+fun(a,b-1,c-1)-fun(a,b-1,c); else return f[a][b][c]=fun(a-1,b,c)+fun(a-1,b-1,c)+fun(a-1,b,c-1)-fun(a-1,b-1,c-1); } } int main() { long long a,b,c; memset(f,-1,sizeof(f)); while(1) { cin>>a>>b>>c; if(a==-1&&b==-1&&c==-1) break; if(a<0||b<0||c<0) cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<fun(0,0,0)<<endl; else if(a>20||b>20||c>20) cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<fun(21,21,21)<<endl; else cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<fun(a,b,c)<<endl; if(a==-1&&b==-1&&c==-1) break; } return 0; } ```
by sehst @ 2021-02-20 15:44:17


@[迟陌](/user/160870) 1.输出格式 2.循环的退出条件
by sehst @ 2021-02-20 15:46:29


@[sehst](/user/364532) 谢谢大佬,发现是空格的问题
by 迟陌 @ 2021-02-20 23:51:26


@[maoyiting](/user/171807) 谢谢大佬!在大佬的指点下AC了!
by 迟陌 @ 2021-02-20 23:58:43


|