| ||||||||||
| 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 | |||||||||
汗。。。同错。。。不过也借机把代码来回看了几遍,简化了不少,思路更清晰了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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator