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

Coldplay : SLOOP | CodeChef Solution

2 min read


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.

قد تُعجبك هذه المشاركات

  • ProblemChef has NN slippers, LL of which are left slippers and the rest are right slippers. Slippers must always be sold in pairs, where each pair contains one left and one right s…
  • ProblemYou and your friend are playing a game with hoops. There are NN hoops (where NN is odd) in a row. You jump into hoop 11, and your friend jumps into hoop NN. Then you jump in…
  • ProblemYou're given an integer N. Write a program to calculate the sum of all the digits of N.Input FormatThe first line contains an integer T, the total number of testcases. Then …
  • ProblemChef 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 ha…
  •  ProblemIn a coding contest, there are prizes for the top rankers. The prize scheme is as follows:Top 10 participants receive rupees X each.Participants with rank 11 to 100 (b…
  • ProblemAlice and Bob are meeting after a long time. As usual they love to play some math games. This times Alice takes the call and decides the game. The game is very simple, Alice…

إرسال تعليق