赞
踩
题目
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;
}
水水水~~
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。