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 |
请问为什么出现Output Limit Exceed?谢谢诸位!!!!#define M 1024 #include"stdio.h" #include"math.h" int Max(int a[M],int n) { int i,j=0; int max; for(i=0;i<n;i++) for(j=0;j<n;j++) { if(a[i]>=a[j]) max=i; else continue; } return(i+1); } int Min(int a[M],int n) { int i,j=0; int min; for(i=0;i<n;i++) for(j=0;j<n;j++) {if(a[i]<=a[j]) { min=i; } else continue; } return(j+1); } main() {int i,n; int a[M],b[M]; int k,l,j; for(j=0;j<3;j++) { scanf("%d",&n); while(n>0&&n<=5000) { for(i=0;i<n;i++) { scanf("%d",&a[i]); b[i]=a[i];} k=Max(a,n); l=Min(b,n); if(k>l) printf("%d\n",k-l); else printf("-1\n"); scanf("%d",&n); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator