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

我的程序wrong answer why??????

Posted by zsl2007 at 2005-12-16 13:29:23 on Problem 2182
 谁能给我一个使我这个程序出错的一组数据阿?
#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:
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