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

So me wrong answer? Help!

Posted by ACM30413 at 2005-12-29 21:01:44 on Problem 2673
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:
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