Problem
Chef is a big fan of Coldplay. Every Sunday, he will drive to a park taking minutes to reach there, and during the ride he will play a single song on a loop. Today, he has got the latest song which is in total minutes long. He is interested to know how many times will he be able to play the song completely.
Input
- The first line contains an integer - the number of test cases. Then the test cases follow.
- The only line of each test case contains two space-separated integers - the duration of the trip and the duration of the song, both in minutes.
Output
For each test case, output in a single line the answer to the problem.
Constraints
Subtasks
Subtask #1 (100 points): original constraints
Sample 1:
3 10 5 10 6 9 10
2 1 0
Explanation:
Test case 1: Chef listens to the song once from minutes and next from minutes.
Test case 2: Chef listens to the song from minutes but now he has only minutes left so he can't complete the song again.
Test case 3: Since the song lasts longer than the journey, Chef won't be able to complete it even once.
Program :
import java.util.*;
class Codechef
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int t,m,s,i;
t=in.nextInt();
for(i=1;i<=t;i++)
{
m=in.nextInt();
s=in.nextInt();
System.out.println(m/s);
}
in.close();
}
}
0 Comments