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:为什么会Output Limit Exceeded?In Reply To:为什么会Output Limit Exceeded? Posted by:quanxiaosha at 2007-09-13 12:45:19 while (scanf("%d",&n != EOF )) > 请大牛看下我的代码:有什么原则上的错误吗? > #include <iostream> > > using namespace std; > > > int main(){ > int n; > int num[50000]; > int count[50000][6]; > while (scanf("%d",&n)){ > for (int i=0;i<n;i++) > for (int j=0;j<6;j++) > count[i][j]=0; > for (i=0;i<n;i++) > scanf("%d",&num[i]); > for (i=0;i<n;i++) > count[i][1]=1; > for(int k=2;k<=5;k++){ > for(i=0;i<n;i++){ > for(int j=i+1;j<n;j++){ > if (num[j]>num[i]) > count[i][k]+=count[j][k-1]; > } > } > } > int result=0; > for (i=0;i<=n-5;i++) > result+=count[i][5]; > cout<<result<<endl; > } > > return 1; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator