Petya and Origami
Petya is having a party soon, and he has decided to invite his nn friends.
He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infinite number of notebooks of each color, but each notebook consists of only one color with kk sheets. That is, each notebook contains kk sheets of either red, green, or blue.
Find the minimum number of notebooks that Petya needs to buy to invite all nn of his friends.
Input
The first line contains two integers nn and kk (1≤n,k≤1081≤n,k≤108) — the number of Petya's friends and the number of sheets in each notebook respectively.
Output
Print one number — the minimum number of notebooks that Petya needs to buy.
Petya is having a party soon, and he has decided to invite his nn friends.
He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infinite number of notebooks of each color, but each notebook consists of only one color with kk sheets. That is, each notebook contains kk sheets of either red, green, or blue.
Find the minimum number of notebooks that Petya needs to buy to invite all nn of his friends.
Input
The first line contains two integers nn and kk (1≤n,k≤1081≤n,k≤108) — the number of Petya's friends and the number of sheets in each notebook respectively.
Output
Print one number — the minimum number of notebooks that Petya needs to buy.
Examples
input
Copy
3 5
output
Copy
10
input
Copy
15 6
output
Copy
38
Note
In the first example, we need 22 red notebooks, 33 green notebooks, and 55 blue notebooks.
In the second example, we need 55 red notebooks, 1313 green notebooks, and 2020 blue notebooks.
题解:此题太水,基本都会
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std; int main()
{
int n,k;
cin>>n>>k;
int red=n*/k;
int green=n*/k;
int blue=n*/k;
if(red<n*2.0/k)
{
red=red+;
}
if(green<n*5.0/k)
{
green=green+;
}
if(blue<n*8.0/k)
{
blue+=;
}
cout<<red+green+blue<<endl;
return ;
}
最新文章
- Hyper-v 安装CentOS 7 (其他虚拟机一样参考)
- iOS 微信支付总结
- 由面试引发的思考:B/S与C/S究竟是何物
- 前端Javascript书籍分享
- 移动混合开发之HTML5在移动开发中的准则
- 黑马程序员——JAVA基础之Map集合
- PID入门的十五个基本概念
- 面试题(C#算法编程题)
- html5时间选择器
- 测试使用wiz来发布blog
- Codeforces Round #143 (Div. 2) (ABCD 思维场)
- 使用ganymed-ssh2-build通过ssh获得远程服务器参数
- MapReduce/Hbase进阶提升(原理剖析、实战演练)
- 如何在Windows Server 2016启用或关闭Internet Explorer增强的安全配置
- MyEclipse编码方式设置
- PYTHON-模块 re subprocess
- windows 10, v1903 正式版下载
- union排序,起别名将两个不同的字段ZCDZ,SCJYDZ 变成同一个别名dz,进行排序;增加一个字段z,进行排序。
- L1&;L2 Regularization的原理
- JS获取客户端公网IP和IP地址