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<iostream> using namespace std; int main() { int T,n; int a[21]; int b[41]={0}; cin>>T; while(T--) { cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; b[a[i]+i]=1; } for(int i=0;i<2*n;i++) { if(b[i]==1) { int r=0,l=0; for(int j=i;j>=0;j--) { if(b[j]==1) r++; else l++; if(l==r) break; } cout<<r<<" "; } } cout<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator