您的位置:首页 > 大数据 > 人工智能

poj 2673 Kicc Wants to Move a Mountain! 模拟水题

2015-11-03 12:21 267 查看
//poj 2673
//sep9
#include <iostream>
using namespace std;

int main()
{
int t,x,m,d=INT_MAX;
scanf("%d%d%d",&t,&x,&m);
if(m==0){
printf("%d",t*x);
return 0;
}
while(m--){
int a,b;
scanf("%d%d",&a,&b);
d=min(d,(a-1)/b);
}
if(d<1){
printf("0");
return 0;
}
int ans=0;
if(t<=d){
ans=t*x;
}else{
t-=d;
ans+=d*x;
t=t/2;
ans+=t*x;
}
printf("%d",ans);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  poj 算法