当前位置:网站首页>OJ daily practice - class dining
OJ daily practice - class dining
2022-06-22 23:33:00 【KJ. JK】
Problem description :
There are N Three students went to the same fast food restaurant for dinner , The fast food restaurant offers a set meal for three 90 element , Double package 70 element , Single package 40 element . What is the minimum cost for the whole class ?
For example, if there is only 1 people , Then the minimum cost of eating is 40 element ; But if there is 7 people , You can order 2 Set meal for three , Add 1 Single set meal , common 220 element .
Input
The first 1 Line an integer M, There are... Below M(0 < M <= 100) Case .
Next there is M That's ok , One integer per row N(0 < N <= 100), There are... In the class N A classmate .
Output
For each case , Output the minimum meal cost of the whole class .
Examples
Input
2
1
7
Output
40
220
Java Code :
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
for (int i = 0; i < num; i++) {
int n = sc.nextInt();
if (n % 3 == 0) {
System.out.println((n / 3) * 90);
} else if (n % 3 == 2) {
System.out.println((n / 3) * 90 + 70);
}
else if (n % 3 == 1)
{
System.out.println((n / 3) * 90 + 40); } } } }
author :KJ.JK
If the article is helpful to you , Welcome to praise or star, Your support is the greatest encouragement to the author , The shortcomings can be corrected in the comments section , Communication and learning
边栏推荐
- How to improve work efficiency? Macintosh efficiency tool set
- C language -- 17 function introduction
- Smart data won two annual awards at the second isig China Industrial Intelligence Conference
- Use smart doc to automatically generate interface documents
- Dip1000,1 of D
- SOA Service Oriented Architecture
- Array and string offset access syntax with curly braces is no longer support
- OJ每日一练——整理命名
- os.Args[1:]中命令行参数为空时,不执行内部语句
- 程序员接私活兼职选择
猜你喜欢

反向代理HAProxy

2021-03-06

2021-04-14

优化——线性规划

c语言---17 函数简介

The breakthrough of key chips hindering Huawei 5g mobile phones has been achieved, and domestic chips have gained 10% share

'dare not doubt the code, but have to doubt the code 'a network request timeout analysis
![[STM32 skill] use the hardware I2C of STM32 Hal library to drive rx8025t real-time clock chip](/img/32/88321db57afb50ccc096d687ff9c41.png)
[STM32 skill] use the hardware I2C of STM32 Hal library to drive rx8025t real-time clock chip

wallys/WiFi6 MiniPCIe Module 2T2R 2 × 2.4GHz 2x5GHz

2021-04-16
随机推荐
同步电路与跨时钟域电路设计2——多bit信号的跨时钟域传输(FIFO)
为 localStorage 添加过期时间
2021-01-29
Freshman girls' nonsense programming is popular! Those who understand programming are tied with Q after reading
Safe and reliable! Tianyi cloud data security management platform passed the evaluation
安装typescript环境并开启VSCode自动监视编译ts文件为js文件
Spark SQL Generic Load/Save Functions(2.4.3)
SSH method 2 for adding node nodes in Jenkins
OJ每日一练—— 班级就餐
2021-03-06
Which securities company is the safest and best choice for stock trading account opening
14. 最长公共前缀
2. interface (calculator)
flink同步mysql数据到ES
Spark SQL 访问json和jdbc数据源
OJ每日一练——过滤多余的空格
ArcGIS应用(二十)Arcgis 栅格图像符号系统提示“This dataset does not have valid histogram required for classificati…”
OJ每日一练——验证子串
弱电转职业网工难不难?华为售前工程师分享亲身经历
Leakcanary source code (2)