A. PizzaForces

题目:https://codeforces.com/contest/1555/problem/A

PizzaForces is Petya’s favorite pizzeria. PizzaForces makes and sells pizzas of three sizes: small pizzas consist of 6 slices, medium ones consist of 8 slices, and large pizzas consist of 10 slices each. Baking them takes 15, 20 and 25 minutes, respectively.

Petya’s birthday is today, and n of his friends will come, so he decided to make an order from his favorite pizzeria. Petya wants to order so much pizza that each of his friends gets at least one slice of pizza. The cooking time of the order is the total baking time of all the pizzas in the order.

Your task is to determine the minimum number of minutes that is needed to make pizzas containing at least n slices in total. For example:

if 12 friends come to Petya’s birthday, he has to order pizzas containing at least 12 slices in total. He can order two small pizzas, containing exactly 12 slices, and the time to bake them is 30 minutes;
if 15 friends come to Petya’s birthday, he has to order pizzas containing at least 15 slices in total. He can order a small pizza and a large pizza, containing 16 slices, and the time to bake them is 40 minutes;
if 300 friends come to Petya’s birthday, he has to order pizzas containing at least 300 slices in total. He can order 15 small pizzas, 10 medium pizzas and 13 large pizzas, in total they contain 15⋅6+10⋅8+13⋅10=300 slices, and the total time to bake them is 15⋅15+10⋅20+13⋅25=750 minutes;
if only one friend comes to Petya’s birthday, he can order a small pizza, and the time to bake it is 15 minutes.
Input
The first line contains a single integer t (1≤t≤104) — the number of testcases.

Each testcase consists of a single line that contains a single integer n (1≤n≤1016) — the number of Petya’s friends.

Output
For each testcase, print one integer — the minimum number of minutes that is needed to bake pizzas containing at least n slices in total.

Example
input
6
12
15
300
1
9999999999999999
3
output
30
40
750
15
25000000000000000
15

又是一个简单题没写出来。。难受

AC代码:

#include <iostream>
using namespace std;

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int t;cin >> t;
	
	while(t--){
		
		long long n;cin >> n;
		//如果小于6说明最少也是要购买一块小披萨,如果n是偶数时,说明怎么都可以凑出6,8,10的组合,
		//如果n是奇数那么说明会多出一块,那么n+1凑成偶数,因为每块披萨是2.5所以转换成下面的公式 
		cout << max(6LL,n+1)/2 * 5 << endl;	
		 
	}
	
	return 0;
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值