A. Petya and Origami
题目链接:https://codeforc.es/contest/1080/problem/A
题意:
给出n,k,k表示每个礼品里面sheet的数量(礼品种类可以不同),现在给n位朋友送礼,每位朋友需要2个xx,5个xx,8个xx,问最少需要买多少礼品。
题解:
水过~
代码如下:
#include <cstring> #include <cstdio> #include <algorithm> #include <iostream> using namespace std; typedef long long ll; ll n,k; int main(){ cin>>n>>k; ll r = 2*n,g = 5*n,b = 8*n; ll ans = r/k+(r%k!=0)+g/k+(g%k!=0)+b/k+(b%k!=0); cout<<ans; }