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 |
请高手看看 ,为什么总是wa#include "stdio.h" main() { long i,j,n,m,a[2000],temp1,temp2,k,t; scanf("%ld",&n); for(i=0,k=0;k<n,i<n;k++,i++) { scanf("%ld",&m); temp1=0; temp2=0; for(j=0;j<m;j++) scanf("%ld",&a[j]); { for(t=0;t<m;t++) for(j=t+1;j<m;j++) if(a[t]<a[j]) temp1++; } { for(t=0;t<m;t++) for(j=t+1;j<m;j++) if(a[t]>a[j]) temp2++; } if(temp1<=temp2) printf("Scenario #%ld:\n%ld\n\n",k+1,temp1); else printf("Scenario #%ld:\n%ld\n\n",k+1,temp2); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator