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

我的程序调试第一组数据多了一,第二组是对的,为什么呢?谢谢

Posted by Ashley at 2005-01-02 21:01:05 on Problem 1922
#include<stdio.h>
void main(){
	while(1){
		int n,i;
    	scanf("%d",&n);
		int a[1000][2];
		if(n==0) break;
		float num,t;
		for(i=0;i<n;i++){
			scanf("%d	%d",&a[i][0],&a[i][1]);
		}
		for(i=0;i<n;i++){
			if(a[i][1]>=0){
			    num=(float)(4500*18/a[i][0]/5+a[i][1]);
				break;}
		}
		for(i=0;i<n;i++){
            if(a[i][1]>=0){
			    t=(float)(4500*18/a[i][0]/5+a[i][1]);
				if(t<num) num=t;}
		}
		printf("%d\n",(int)num+1);
	}
}


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