A——Sim Card

A( 1259 ): Sim Card
Submit Page      Time Limit: 3 Sec       Memory Limit: 512 Mb       Submitted: 35       Solved: 31    

Description

There are three mobile operators in Iran. Each operator has different prices for call and data usage, given in the table below. All prices are in Rials:

Some foreign students have arrived Iran to participate in the ACM-ICPC, Tehran Site. They already know how many minutes they will call, and how much Internet they will use. For each student, you want to recommend an operator to minimize the total cost of call usage and data usage for that student.

Input

Each line of the input contains the information of one student. For each student, there are two positive integers c and d (1 ⩽ c, d ⩽ 1000) that show the amount of call (in minutes) and data usage (in megabytes) for the student, respectively. The input terminates with “0 0” that should not be processed.

Output

For each student, print a line containing the minimum total cost of call usage and data usage.

Sample Input

10 60 
100 20 
24 12 
900 400 
50 50 
0 0

Sample Output

1600
3800
1200
43000
3000

签到题:直接两个min就可以了。

ac代码。

#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int main()
{
	while(cin>>a>>b)
	{
		if(a==0&&b==0)
		   return 0;
		else
		{
			long long ans=min(min(30*a+40*b,35*a+30*b),40*a+20*b);
			cout<<ans<<endl;
		}
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值