当前位置:网站首页>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
边栏推荐
- SSH method 2 for adding node nodes in Jenkins
- C sqlsugar, hisql, FreeSQL ORM framework all-round performance test vs. sqlserver performance test
- OJ每日一练——跨越2020
- Longest word in output string
- Learning the interpretable representation of quantum entanglement, the depth generation model can be directly applied to other physical systems
- js----SVG转PNG
- PHP7.3报错undefined function simplexml_load_string()
- 剑指 Offer 05. 替换空格
- Summary of transport layer knowledge points
- C language -- 17 function introduction
猜你喜欢

2021-04-16

c# sqlsugar,hisql,freesql orm框架全方位性能测试对比 sqlserver 性能测试

Customize multi-level list styles in word

反向代理HAProxy

'dare not doubt the code, but have to doubt the code 'a network request timeout analysis

Redis缓存

China Mobile's mobile phone users grow slowly, but strive for high profit 5g package users

Spark RDD Programming Guide(2.4.3)

【Kubernetes 系列】Kubernetes 概述

口令安全是什么意思?等保2.0政策中口令安全标准条款有哪些?
随机推荐
Considerations for using redisson to operate distributed queues
Tp5.1 solving cross domain problems
Unity:利用 射线Ray 检测物体
Spark SQL Generic Load/Save Functions(2.4.3)
Reddit's discussion on lamda model: it is not stateless. It adopts a dual process. Compared with the way it edits Wikipedia, it doesn't matter whether it has feelings or not
剑指 Offer 06. 从尾到头打印链表
同步电路与跨时钟域电路设计2——多bit信号的跨时钟域传输(FIFO)
Digital data was invited to participate in Nantong enterprise digital transformation Seminar
Install the typescript environment and enable vscode to automatically monitor the compiled TS file as a JS file
JSBridge
eslint 简单配置
2021-05-02
C language -- 17 function introduction
Autoincrement attribute of sqlserver replication table
Bubble sort pointer
2020-12-04
wallys/WiFi6 MiniPCIe Module 2T2R 2 × 2.4GHz 2x5GHz
Spark RDD Programming Guide(2.4.3)
异步FIFO
OJ每日一练——整理命名