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

Sign-in question: Just two mins directly.

ac code.

#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;
}


Intelligent Recommendation

SIM card APDU instruction

An APDU can be a command or a response to a command. The general format of the command APDU: CLA INS P1 P2 P2 Data P3 Data The general format for responding to APDUs: Data, SW1, SW1, SW2 The meaning o...

SIM card APDU command

An APDU can be a command or a response to a command. The general format of the command APDU: CLA INS P1 P2 P3 Data The general format of the response APDU: Data SW1 SW2 The meaning of each byte is as ...

SIM card built by OAI

First of all, please make sure that you have set up EPC and ENB, and they can be connected (if the MME is connected, there will be a related display, and the ENB side will also display mme is associat...

SIM card initialization

//SIM card initialization...

SIM card --- status change

6,SIMcard The main content of the SIM card includes the change of the status of the SIM card information. Among them, the state change is mainly reported from the Modem to the RIL daemon and finally r...

More Recommendation

2027: Sim Card

http://acm.csu.edu.cn:20080/csuoj/problemset/problem?pid=2027 Give full play to your English reading level, probably the three major operators. Only one operator can be used. You call and surf the Int...

Sim card operator obtains

Sim card operator obtains 1. Description SIM (Subscriber Identification Module): Subscriber identification module, the card is mainly used as the unique identity of the user. When the status of the SI...

SIM card management

// Get the TelephonyManager instance object final TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);  // Get the number of SIM cards final int num...

SIMID (SIM card use)

How to use the development board to implement SIM function Directory name How to use the development board to implement SIM function Introduction Material preparation step common problem Related infor...

Camera with SIM card

Why can't 80% of the code farmers can't do architects? >>>   step: Enter Camera App -> Switch to VIDEO mode -> Turn on the flash -> Press POWER key lock screen -> Press ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top