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 |
Re:好吧,我学得不好,实在搞不懂。。。In Reply To:好吧,我学得不好,实在搞不懂。。。 Posted by:lisanwan at 2008-12-11 20:56:43 > //这是第一份代码,wa!!! > #include <iostream> > #include <cmath> > using namespace std; > int main() > { > int n; > double a,b,t,min; > while(1) > { > cin>>n; > if(n == 0) > break; > min=0.0; > for(int i = 0; i != n; i++) > { > cin>>a>>b; > if(b < 0) continue; > t = ceil(4.5*(double)3600/a + b); > if(i == 0) min = t; > else if(min > t) min = t; > } > cout<<(int)min<<endl; > } > return 0; > } > > //这是第二份,ac!!!! > #include <iostream> > #include <cmath> > using namespace std; > int main() > { > int n,a,b; > double t,min; > while(1) > { > cin>>n; > if(n == 0) > break; > min=1e18; > for(int i = 0; i < n; i++) > { > cin>>a>>b; > if(b >= 0) > { > t = ceil(4.5*(double)3600/(double)a + (double)b); > if(t < min) > min = t; > } > } > cout<<(int)min<<endl; > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator