Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

各路大神 求助 很多样例都过了。。。。还是wa

Posted by 268123lry at 2014-11-29 11:40:34 on Problem 1068
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator