Codeforces965—A:Paper Airplanes(思维)

39 篇文章 1 订阅
10 篇文章 0 订阅

链接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;
}

水水水~~

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值