当前位置:网站首页>【CCF CSP】201709-1打酱油
【CCF CSP】201709-1打酱油
2022-07-21 11:27:00 【jennie佳妮】
问题描述
试题编号: | 201709-1 |
试题名称: | 打酱油 |
时间限制: | 1.0s |
内存限制: | 256.0MB |
问题描述: | 问题描述 小明带着N元钱去买酱油。酱油10块钱一瓶,商家进行促销,每买3瓶送1瓶,或者每买5瓶送2瓶。请问小明最多可以得到多少瓶酱油。 输入格式 输入的第一行包含一个整数N,表示小明可用于买酱油的钱数。N是10的整数倍,N不超过300。 输出格式 输出一个整数,表示小明最多可以得到多少瓶酱油。 样例输入 40 样例输出 5 样例说明 把40元分成30元和10元,分别买3瓶和1瓶,其中3瓶送1瓶,共得到5瓶。 样例输入 80 样例输出 11 样例说明 把80元分成30元和50元,分别买3瓶和5瓶,其中3瓶送1瓶,5瓶送2瓶,共得到11瓶。 |
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,res;
cin >> n;
res = (n / 50) * 7;
n %= 50;
res += (n / 30)*4 ;
n %= 30;
res += (n / 10);
cout << res;
return 0;
}
边栏推荐
猜你喜欢
32位栈溢出进阶
Sequences, Time Series and Prediction in Tessorflow quizs on Coursera (二)
Multiplier technology cloud management and control platform adapts to Alibaba cloud polardb, and jointly promotes the prosperity of cloud native database ecosystem
攻防世界新手区pwn
Idea建文件夹时,文件夹的空文件夹的展开与重叠
2022年7月31日DAMA-CDGA/CDGP数据治理认证班开启!
PAM4科普
How to build a good knowledge base management system?
Code management (novice)
2.3线性表的链式表示(1)
随机推荐
servlet写webapp时,用filter拦截实现登陆验证
Cadence OrCAD Capture TCL/TK脚本实例
Integer
Su Chunyuan, founder of science and technology · CEO of Guanyuan data: making business use is the key to the Bi industry to push down the wall of penetration
秒杀设计
企业进行知识管理有哪些好处?
攻防世界新手区pwn
Convolutional Neural Networks in TensorFlow quizs on Coursera
C language exercises - structure and union
2022年7月31日DAMA-CDGA/CDGP数据治理认证班开启!
乘数科技云管控平台适配阿里云PolarDB,共促云原生数据库生态繁荣
He has been in charge of the British Society of engineering and technology for 13 years, and van nugget officially retired
idea报错求助!!!!
Clean up SYSTEMd logs
为JTable添加按列选择功能
定时任务框架
wireshark简单过滤规则
2.2线性表的顺序表示
免费开源的网址导航源码收集整理汇总-自建个人导航主页
32位栈溢出进阶