STS - editorial

Practice
ALGO2020

Editorialist - akshayakgec

DIFFICULTY:

Easy

PREREQUISITES:

Basic Maths

PROBLEM:

You just have to the count the number of boxes he has to buy so that he can have n numbers of sheets.

QUICK EXPLANATION:

Just find out the upper bound (n + k - 1/k)

EXPLANATION:

To find the minimum boxes:- If the number of sheets required (n) is divisible by sheets in each box (k) or n is multiple of k then our answer will be n/k i.e. the quotient obtained when we divide n by k. But if n is not a multiple of k then we will need (n/k)+1 boxes i.e 1 extra box because we have to buy a complete box.

Editorialist's Solution
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int> 
#define f first
#define s second
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
	int a,b;
	cin>>a>>b;
	cout<<(a/b) + (a%b > 0)<<endl;
}

}