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

0秒AC模拟无压力!!!附代码

Posted by wocha at 2012-05-15 13:01:53 on Problem 1068
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int A[2312];
char str[2343];
int n,m,i,j,k,l,q,w,e,r;
while(~scanf("%d",&n))
{
while(n--)
{
scanf("%d",&m);
A[0]=0;
memset(str,0,sizeof(str));
for(i=1;i<=m;i++)
{
scanf("%d",&A[i]);
}
q=0;
for(i=1;i<=m;i++)
{
for(j=0;j<A[i]-A[i-1];j++)
{
str[q++]='(';
}
str[q++]=')';
}
k=strlen(str);
for(q=0;q<k;q++)
{
if(str[q]==')')
{
int count=0;
for(l=q-1;l>=0;l--)
{
if(str[l]!=')')
count++;
if(str[l]=='(')
{
str[l]='~';

break;
}


}
printf("%d ",count);
}
}
printf("\n");
}
}
}

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