Lorem ipsum dolor sit amet, consectetur adipiscing elit. Test link

Coldplay : SLOOP | CodeChef Solution


Problem

Chef is a big fan of Coldplay. Every Sunday, he will drive to a park taking MM 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 SS minutes long. He is interested to know how many times will he be able to play the song completely.

Input Format

  • The first line contains an integer TT - the number of test cases. Then the test cases follow.
  • The only line of each test case contains two space-separated integers M, SM,S - the duration of the trip and the duration of the song, both in minutes.

Output Format

For each test case, output in a single line the answer to the problem.

Constraints

  • 1 \leq T \leq 1000
  • 1 \leq M \leq 100
  • 1 \leq S \leq 10
  • 1 \leq T \leq 1000

Sample 1:

Input
Output
3
10 5
10 6
9 10
2
1
0

Explanation:

Test case 1: Chef listens to the song once from 0 - 50−5 minutes and next from 5 - 105−10 minutes.
Test case 2: Chef listens to the song from 0 - 60−6 minutes but now he has only 44 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.

Solution

#include <iostream>
using namespace std;

// Solution from : Code Radius [ https://radiuscode.blogspot.com/ ]

int main() {
int t;
cin>>t;
while(t--)
{
int M,S,A;
cin>>M>>S;
A=M/S;
if (M>=S)
{
cout<<A<<endl;
}
else
{
cout<<"0"<<endl;
}
}
return 0;

}

Please First Try to Solve Problem by Yourself.

إرسال تعليق

© Code Radius 2. All rights reserved. Distributed by Techy Darshan Distributed by Pro Templates