| ||||||||||
| 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 | |||||||||
PKU的机器好In Reply To:为什么在pku通过了在zju却超时?? Posted by:tbaitm at 2005-12-11 01:08:24 > #include<iostream>
> //#include<fstream>
>
> using namespace std;
>
> int main()
> {
> //ifstream cin("source.txt");
> long i,j,k,w[21][21][21]={0};
>
> for(i=0;i<21;i++)
> for(j=0;j<21;j++)
> w[0][i][j] = w[i][0][j] = w[i][j][0] = 1;
>
> for(i=1;i<=20;i++)
> for(j=1;j<=20;j++)
> for(k=1;k<=20;k++)
> 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(cin>>i>>j>>k)
> {
> if(-1==i&&-1==j&&-1==k)break;
> if(i<=0||j<=0||k<=0)
> {
> cout<<"w("<<i<<", "<<j<<", "<<k<<") = "<<1<<endl;
> continue;
> }
> if(i>20||j>20||k>20)
> {
> cout<<"w("<<i<<", "<<j<<", "<<k<<") = "<<w[20][20][20]<<endl;
> continue;
> }
> cout<<"w("<<i<<", "<<j<<", "<<k<<") = "<<w[i][j][k]<<endl;
> }
>
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator