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 ;
}
Petya and Origami的更多相关文章
- Codeforces Round #524 (Div. 2) A. Petya and Origami
A. Petya and Origami 题目链接:https://codeforc.es/contest/1080/problem/A 题意: 给出n,k,k表示每个礼品里面sheet的数量(礼品种 ...
- CF1080A Petya and Origami 题解
Content 小 P 想给 \(n\) 位朋友各发一张邀请函,每张邀请函需要耗费 \(2\) 张红色纸,\(5\) 张绿色纸和 \(8\) 张蓝色纸.商店里面的纸是一堆一堆卖的,每堆里面有 \(k\ ...
- Codeforces Round #524 (Div. 2)
A. Petya and Origamitime limit per test1 secondmemory limit per test256 megabytesinputstandard input ...
- Codeforces Round #524 (Div. 2) Solution
A. Petya and Origami Water. #include <bits/stdc++.h> using namespace std; #define ll long long ...
- CodeForces-Round524 A~D
A. Petya and Origami time limit per test 1 second memory limit per test 256 megabytes input stan ...
- Codeforces Round #524 (Div.2)题解
题解 CF1080A [Petya and Origami] 这道题其实要我们求的就是 \[\lceil 2*n/k \rceil + \lceil 5*n/k \rceil + \lceil 8*n ...
- Codeforces Round #524 (Div. 2)(前三题题解)
这场比赛手速场+数学场,像我这样读题都读不大懂的蒟蒻表示呵呵呵. 第四题搞了半天,大概想出来了,但来不及(中途家里网炸了)查错,于是我交了两次丢了100分.幸亏这次没有掉rating. 比赛传送门:h ...
- Petya勒索木马
同事小学妹神好奇心,在陌生群里下载了个软件,接下来就是自动重启无法开机. 找我一看,凭我专业帮妹纸装系统多年的经验,起初也不觉得有啥困难,兼容模式下重启,接下来出现这个: 按下any key后: 试了 ...
- Origami – 用于 Quartz 的免费的交互设计框架
Origami 是一个为 Quartz Composer 开发的免费的工具包——由Facebook设计团队创建,让交互设计原型更加简单,不需要编程. 如今,大多数设计师通过创建静态原型来表达要实现的应 ...
随机推荐
- c#.net常用字符串函数 字符串常用方法 string
RegionsStr = RegionsStr.Remove(RegionsStr.LastIndexOf(","), 1); //去掉最后一个逗号 string html = ...
- Shiro权限框架简介
http://blog.csdn.net/xiaoxian8023/article/details/17892041 Shiro权限框架简介 2014-01-05 23:51 3111人阅读 评论 ...
- Android开源地图项目 BigPlanetTracks 学习随笔
一. app主体部分 [tyt.android.bigplanettracks] 二. 地图部分 [tyt.android.bigplanettracks.maps] ...
- JAVA基础知识总结8(设计模式)
设计模式:JAVA中有23种设计模式 1.解决问题最行之有效的思想. 2.是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结. 3.使用设计模式是为了可重用代码.让代码更容易被他人理解 ...
- sg值的求解(NIM)
硬币游戏2 挑战程序设计竞赛P315 1堆的情况: #include<bits/stdc++.h> ,grundy[],k=,A[]={,},n=; using namespace std ...
- 05 HTML字符串转换成jQuery对象、绑定数据到元素上
1 要求 将一段 HTML脚本 封装成一个字符串,将这个字符串转换成一个jQuery对象:然后将这个jQuery对象添加到指定的元素中去 2 步骤 定义字符串 var str = '<div i ...
- Hive安装及配置
第一步:下载hive并解压 tar zxvf hive-0.8.1-bin.tar.gz 重命名: mv hive-0.8.1-bin hive 给权限:chown hadoop:hadoop hiv ...
- 使用 classList API
一.classList API 是什么 属于 DOM API,HTML5 引入,用来操作 HTML 标签的 class 属性值. classList 属性是一个只读的类数组对象,"实时&qu ...
- Web信息架构:设计大型网站(第3版) [美]Peter Morville 中文PDF扫描版
新版Web信息架构设计大型网站针对新技术做了全面更新——搭配新颖范例.全新场景及最佳实践信息——但是,其焦点依然放在基础原理上.其结构严谨,图文并貌,内容涵盖了信息架构基本原理和实践应用的方方面面. ...
- 用LINQ获取XML节点数据
Insus.NET想对<从字符串中获取XML节点数据> http://www.cnblogs.com/insus/p/3299052.html 这篇改写为使用LINQ的方法实现.LINQ中 ...