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 |
谁来帮帮我,为什么WA?#include<stdio.h> int main() {int a[8001],b[8001],c[8001],n,i,j; scanf("%d",&n); for(i=1;i<=n;i++) c[i]=i; for(i=2;i<=n;i++) scanf("%d",&a[i]); b[n]=a[n]+1; for(i=n-1;i>=2;i--) { b[i]=a[i]+1; for(j=n;j>i;j--) {if(b[j]<=b[i]) b[i]+=1; } } for(i=1;i<=n;i++) for(j=2;j<=n;j++) if(b[j]==i) c[i]=0; for(i=1;i<=n;i++) if(c[i]!=0) b[1]=c[i]; for(i=1;i<=n;i++) printf("%d\n",b[i]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator