| ||||||||||
| 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 | |||||||||
So me wrong answer? Help!In Reply To:Who can tell me why it is wrong answer? Thank you! Posted by:Ray_xiang at 2005-10-17 19:54:55 #include<iostream>
using namespace std;
int main()
{
int d,s,mint,m,t,x,a;
while(cin>>t>>x){
cin>>m;
if(m==0) cout<<t*x<<endl;
else{
mint=100000000;
while(m--)
{
cin>>d>>s;
a=(d-1)/s;
if(mint>a) mint=a;
}
if(t==0||mint<2) cout<<0<<endl;
else if(mint>t) cout<<t*x<<endl;
else cout<<((mint-1)+(t-mint+1)/2)*x<<endl;
//cout<<mint*x<<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