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

Re:大家帮忙看看为什么行不通

Posted by duchengyi at 2015-07-26 11:40:04 on Problem 1068
In Reply To:大家帮忙看看为什么行不通 Posted by:lenohoo at 2011-12-23 21:51:22
> #include<stdio.h>
> int main()
> {
>     int t,n,a,s[10000],stack[10000],top,rear,k,i,count;
>     while((scanf("%d",&t))!=EOF)
>     {
>         while(t--)
>         {
>             rear=0;
>             scanf("%d",&n);
>             scanf("%d",&a);
>             k=a;
>             for(i=0;i<a;i++)
>                 s[rear++]=1;
>             s[rear++]=2;
>             for(i=1;i<n;i++)
>             {
>                 scanf("%d",&a);
>                 for(i=0;i<a-k;i++)
>                     s[rear++]=1;
>                 s[rear++]=2;
>                 k=a;
>             }
>             i=0;
>             count=0;
>             top=0;
>             stack[top]=s[0];
>             printf("haha\n");
>             while((++i<rear)&&(top>=0))
>             {
>                 if(s[i]+s[i-1]==3)
>                 {
>                     count++;
>                     printf("%d ",count);
>                     top--;
>                 }
>                 else
>                 {
>                     count=0;
>                     stack[++top]=1;
>                 }
> 
>             }
>             printf("\n");
>         }
>     }
>     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