标签:
#include<iostream>cheng da cai zi 11.21 //#include<stdio.h> #include<math.h> using namespace std; int main() { //freopen("1922.txt","r",stdin); int num_rider; double sum; double v; double time; double item; while(1){ cin>>num_rider; if(num_rider==0) return 0; sum=1e18; while(num_rider--) { cin>>v; cin>>time; if(time>=0) { item=4500*3.6/v+time;// 我的错误就在这个精度计算上了!!! 暴怒! if(item<sum) sum=item; } } cout<<ceil(sum)<<endl; } return 0; } /*#include<iostream>//我最原始的代码,和后来的借鉴版不一样 #include<stdio.h> using namespace std; int main() { //cout<<4500/(20/3.6)<<endl; //freopen("1922.txt","r",stdin); int num_rider=0; double sum=0; double v=0; double time=0; double item=0; int i=0; while(1){ cin>>num_rider; if(num_rider==0) return 0; i=0; while(num_rider--) { cin>>v; cin>>time; if(time>=0)//这里也很重要!!! { if(i==0){ sum=4500*3.6/v+time;//开始错误的源泉; i++; } item=4500*3.6/v+time; if(item<=sum) sum=item; } } i=int(sum); if(i<sum)//这里我没用到ceil(); cout<<i+1<<endl; else cout<<int(sum)<<endl; } return 0; } */
标签:
原文地址:http://www.cnblogs.com/gavinsp/p/4566572.html