-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOOKPACK.cpp
More file actions
31 lines (25 loc) · 839 Bytes
/
BOOKPACK.cpp
File metadata and controls
31 lines (25 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*Problem
Chef is moving to a new house!
Unfortunately, this means he now has to pack up his things so that they can be moved too. Currently, Chef is packing up his (rather impressive) book collection into cardboard boxes.
Chef has
�
X shelves of books, each of which contains exactly
�
Y books. Each cardboard box can hold at most
�
Z books. In order to not mess up the organization of the books, Chef will also ensure that books from different shelves will not be placed in the same box.
Under these conditions, what is the minimum number of boxes needed to pack all the books?*/
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int x,y,z;
cin>>x>>y>>z;
if(y%z==0)
cout<<(y/z) * x<<endl;
else
cout<<(y/z + 1) * x<<endl;
}
}