965A Paper Airplanes

A. Paper Airplanes
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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

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

Input

The only line contains four integers kknnsspp (1k,n,s,p1041≤k,n,s,p≤104) — the number of people, the number of airplanes each should make, the number of airplanes that can be made using one sheet and the number of sheets in one pack, respectively.

Output

Print a single integer — the minimum number of packs they should buy.

Examples
input
Copy
5 3 2 3
output
Copy
4
input
Copy
5 3 100 1
output
Copy
5
Note

In the first sample they have to buy 44 packs of paper: there will be 1212 sheets in total, and giving 22 sheets to each person is enough to suit everyone's needs.

In the second sample they have to buy a pack for each person as they can't share sheets.


Problem solution: k people origami planes, each person must fold n paper planes, and then there is a sheet of paper that can fold s paper planes, and a pack of paper has p sheets of paper. Output the minimum number of packs of paper to be purchased. A simple question, I have read it for a long time, the second group of examples is
what it means, 5 people, each person needs to fold 3 paper planes, a piece of paper can fold 100 paper planes, there is only one piece of paper in a pack of paper, although one A sheet of paper can fold 100 planes, but each sheet of paper can only be used by one person, so 5 packs of paper are needed.


Solution: Simulation First calculate the amount of paper each person needs, and then multiply by the number of people divided by the number of papers in a pack, which is the number of packs. To be rounded up. For example, in Example 2, each person needs to fold three planes, and a piece of paper can fold 100 pieces. 3/100 is the number of sheets each person needs, and it is 0 if it is not rounded up. Then multiply by the number of people, that is, the total number of sheets needed, divide by the number of sheets per pack, and round up. C++ has the ceil function, which in the math header file means rounding up. The final result must be converted to Int type, otherwise the third group of data, the result is a bit problematic, you can also take the remainder judgment without ceil, the remainder 0 is the result of the division, otherwise the result is +1.

#include<bits/stdc++.h>
using namespace std;
intmain()
{
    double k,n,s,p;
    cin>>k>>n>>s>>p;
    cout << int (ceil (ceil (n / s) * k / p));
    return 0;
}


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325685295&siteId=291194637