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 |
我的程序调试第一组数据多了一,第二组是对的,为什么呢?谢谢#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator