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 |
我的程序wrong answer why??????谁能给我一个使我这个程序出错的一组数据阿? #include<stdio.h> int main() { int cow[10005],cow1[10005]; int n,i,j,sum; int key[10005]; while(scanf("%d",&n)!=EOF){ for(i=2;i<=n;i++) scanf("%d",&key[i]); for(i=1;i<=n;i++) cow1[i]=0; for(i=2;i<=n-1;i++) { sum=0; for(j=i+1;j<=n;j++) if(key[i]+j-i-1>=key[j]) ++sum; cow[i]=sum+key[i]+1; cow1[cow[i]]=1; } cow[n]=key[n]+1; cow1[cow[n]]=1; for(i=1;i<=n;i++) if(cow1[i]==0) {cow[1]=i;break;} for(i=1;i<=n;i++) printf("%d\n",cow[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