当前位置:   article > 正文

Codeforces965—A:Paper Airplanes(思维)_codeforces -965a

codeforces -965a

链接Codeforce965—A题传送门

题目
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.

A group of k people decided to make n airplanes each. They are going to buy several packs of paper, each of them containing p sheets, and then distribute the sheets between the people. Each person should have enough sheets to make n airplanes. How many packs should they buy?

题意
k个人要叠纸飞机,每个人要叠n个纸飞机,一张纸能叠s个飞机,买纸只能一包一包买,一包有p张纸。
问你他们最少要买几包纸?

思路
题目有点绕,看清楚每个变量的意义。
首先算出每个人需要几张纸,然后算出一共需要多少张,最后算一下要多少包就好。
需要注意的是第二个样例中,一张纸能叠100个飞机,但是我们还是只叠一个。所以就是宁可浪费也不少买。(杜绝浪费!)

看一下代码,伊丽莎白!

在这里插入图片描述
代码

//double ceil(double x): 返回大于或者等于x的最小整数
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double k,n,s,p;
    cin>>k>>n>>s>>p;
    double ans=ceil(n/s);
    cout<<int(ceil(ans*k/p))<<endl;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

水水水~~

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/1003960
推荐阅读
相关标签
  

闽ICP备14008679号