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 |
求大神告知,为啥在vc运行结果对,提交之后总是wrong anser#include<iostream> #include<string> using namespace std; int main() { int n,i,m,x,y,j,num,s[21],a[21]; cin>>n; while(n--!=0) { memset(s,0,sizeof(s)); memset(a,0,sizeof(a)); cin>>num; for(i=0;i<num;i++) cin>>a[i]; for(i=0;i<num;i++) { s[a[i]+i]=1; } for(i=0;i<num*2;i++) { if(s[i]==0)continue; x=1; y=1; for(j=i-1;j>0;j--) { if(s[j]==1) { x++; y++; } else x--; if(x==0)break; } if(i==num*2-1) cout<<y<<" "<<endl; else cout<<y<<" "; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator