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 |
崩溃了。。。。到底哪里错了?求帮忙看看!!!看是不是思路错了~~求数据!!!#include<iostream> #define N 10995 #define inf 100 using namespace std; int a[N]; int main() { int t,n,m,i,num,max,pos; scanf("%d",&t); while(t--) { num=0; max=inf; scanf("%d%d",&n,&m); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) { if(a[i]>a[m]) { num++; if(max>a[i]) { max=a[i]; pos=i; } }//找出比我要打的大的最小的数 } for(i=pos;i<pos+n;i++) { if(a[i%n]==a[m]) num++;//和自己一样大却在自己之前的 if(i%n==m) break; } printf("%d\n",num); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator