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

把 #include <conio.h>去掉就好了

Posted by Sempr at 2006-04-30 15:20:59 on Problem 2487
In Reply To:帮忙看一下为什么是编译错误?我在我这儿运行的好好的啊?多谢 Posted by:25181554 at 2006-04-30 14:38:47
> #include <stdlib.h>
> #include <stdio.h>
> #include <conio.h>
> 
> void main()
> {
> 	int n,peo,i,j,sta;
> 	int fri[1000];
> 
> 	//输入case的数目
> 	scanf("%d",&n);
> 	fflush(stdin);
> 	if(n<1 || n>1000000)  exit(-1);
> 
> 	//循环进行每次的输入,由i控制
> 	for(i=0;i<n;i++)
> 	{
> 		scanf("%d%d",&sta,&peo);
> 		getchar();
> 
> 		if(sta<1 || sta>1000000 || peo<1 || peo>1000)  exit(-1);
> 
> 		//控制每个人可以借给的钱数,每个人由j控制
> 		for(j=0;j<peo;j++)
> 		{
> 			scanf("%d",&fri[j]);
> 			if(fri[j]<1 || fri[j]>10000)  exit(-1);
> 		}
> 		getchar();
> 
> 		//排序(从大到小)选择排序法
> 		{
> 			int k,m;
> 
> 			for(j=0;j<peo-1;j++)
> 			{
> 				k = j;
> 				for(m=j+1;m<peo;m++)
> 					if(fri[k]<fri[m])
> 						k = m;
> 				if(k!=j)
> 					fri[k]^=fri[j]^=fri[k]^=fri[j];
> 			}
> 		}
> 
> 		printf("Scenario #%d:\n",i+1);
> 		//判断最少要借多少人的
> 		{
> 			int sumsta = 0;
> 
> 			j = 0;
> 			do
> 			{
> 				sumsta += fri[j];
> 				j++;
> 				if(j==peo && sumsta<sta)
> 				{
> 					printf("impossible\n\n");
> 					exit(1);
> 				}
> 			}while(sumsta<sta);
> 
> 			printf("%d\n\n",j);
> 		}
> 			
> 	}
> }

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