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

汗。。。同错。。。不过也借机把代码来回看了几遍,简化了不少,思路更清晰了

Posted by hustcswgy at 2011-08-22 23:59:39 on Problem 1363
In Reply To:鉴后来者!不要栽在小错手里!!!!!!! Posted by:ds0448041 at 2005-09-21 21:48:54
/* Yes和No写成大写了,白白哇了两次。不过也把程序看了几遍,简化了很多 */
#include <stdio.h>

int main()
{
    int n;
    while(scanf("%d", &n), n)
    {
        int seq[1010];
        while(scanf("%d", &seq[0]), seq[0])
        {
            int i;
            int in = 1;
            int station[1010]; int sp = -1;
            for(i = 1; i < n; i ++) scanf("%d", &seq[i]);
            for(i = 0; i < n; i ++)
            {
                if(seq[i] < in && sp >= 0 && station[sp] != seq[i]) break;
                while(sp < 0 || station[sp] != seq[i]) station[++sp] = in++;
                sp--;
            }
            if(i < n) printf("No\n");
            else printf("Yes\n");
        }
        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