| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:为什么会WA???大牛们帮下忙看看 谢谢In Reply To:为什么会WA???大牛们帮下忙看看 谢谢 Posted by:dhl23 at 2008-10-10 22:18:04 > #include<iostream>
> #include<cstdio>
> using namespace std;
>
> int w[25][25][25];
>
> int main()
> {
> int i,j,k,a,b,c;
> cin>>a>>b>>c;
> for(i=0;i<=20;i++)
> {
> for(j=0;j<=20;j++)
> {
> for(k=0;k<=20;k++)
> {
> if(i==0||j==0||k==0)
> w[i][j][k]=1;
> else if(i<j&&j<k)
> w[i][j][k]=w[i][j][k-1]+w[i][j-1][k-1]-w[i][j-1][k];
> else
> w[i][j][k]=w[i-1][j][k]+w[i-1][j-1][k]+w[i-1][j][k-1]-w[i-1][j-1][k-1];
> }
> }
> }
> while(a!=-1||b!=-1||c!=-1)
> {
> if(a>20||b>20||c>20)
> printf("w(%d, %d, %d) = %d\n",a,b,c,w[20][20][20]);
> else if(a<=0||b<=0||c<=0)
> printf("w(%d, %d, %d) = 1\n",a,b,c);
> else
> printf("w(%d, %d, %d) = %d\n",a,b,c,w[a][b][c]);
> cin>>a>>b>>c;
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator