Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Finally, College has started calling students back to campus. There are so many students and thus due to some safety measures the college can’t call back all the students on the same day. It currently has the capacity of screening K students on a single day. There is a total of N students. What’s the minimum number of days required for all the students to be back on the campus?
For each test case, print a single line containing one integer – the minimum number of days required for all the students to be back on the campus.
Input:
3
3 3
3 2
4 3
Output:
1
2
2
Test case 1: Since K=3 and N=3, we can call all 3 students back to campus on the first day itself. Hence it requires only 1 day for all students to be back on campus.
Test case 2: We have K=2 and N=3>K, so we can’t call all the students back to campus on a single day. But we can call 1 student on the first day and the remaining 2 students on the second day. Therefore, we require a minimum of 2 days for all students to be back on campus.
Test case 3: We have K=3 and N=4>K, so we can’t call all the students back to campus on a single day. But we can call 2 students on the first day and the remaining 2 students on the second day. Therefore, we require a minimum of 2 days for all students to be back on campus.
# cook your dish here
import math
t = int(input())
for _ in range(t):
n,k = map(int,input().split())
print(math.ceil(n/k))
#include <iostream>
using namespace std;
// your code goes here
int main() {
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
if(n%k==0){
cout<<n/k<<endl;
}
else{
cout<<(n/k)+1<<endl;
}
}
return 0;
}
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner in=new Scanner(System.in);
int te=in.nextInt();
while(te-->0)
{
int n=in.nextInt();
int k=in.nextInt();
int res=(int)n/k;
if(n%k != 0)
res+=1;
System.out.println(res);
}
}
}
In our experience, we suggest you solve this Back to Campus CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Back to Campus CodeChef Solution
I hope this Back to Campus CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>