Please Fill out the Feedback Form for Code Radius

Apple and Day : APPDAY | CodeChef Solution

Problem

You have N Apples.You can eat K apples on a single day.What's the minimum number of days required to eat all apples?

Please Share this article...

Input Format

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains two space-separated integers N, K.

Output Format

For each test case, print a single line containing one integer - the minimum number of days required to eat all apples.

Constraints

Sample

Input
3
3 3
3 2
Output
1
2

Explanation

Test case 1: Since K = 3 and N = 3,it requires only 1 day to eat all apples.
Test case 2: We have K = 2 and N = 3 > K, it require a minimum of 2 days to eat all apples..

Solution

#include <iostream>
using namespace std;
int main(){
	int t , x ,y ;
	cin >>t ;
	while(t--) {
	    cin >> x >>y ;
	    if ( x %y ==0 )
	    cout << x/y << endl ;
	    else 
	    cout << (x/y)+1 << endl ;
	}
	return 0;
}

Coming Soon
coming soon

Please First Try to Solve Problem by Yourself.

Post a Comment

© Code Radius. All rights reserved. Distributed by Code Rdius Distributed by Pro Templates