Coldplay: SLOOP

                     

CU Submission link: Click here

Public Submission link: Click here

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

  • 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

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

Constraints

  • 1≤T≤10001≤T≤1000
  • 1≤M≤1001≤M≤100
  • 1≤S≤101≤S≤10

Subtasks

Subtask #1 (100 points): original constraints

Sample Input 1 

3
10 5
10 6
9 10

Sample Output 1 

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.

Coldplay codechef solution in C++ 14

// code start from int main so paste from here 

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    int m,s;
	    cin>>m>>s;
	    cout<< m/s<< endl;
	}
	return 0;
 }

Coldplay codechef solution in Python 3

# cook your dish here
for _ in range(int(input())):
    m,s=map(int,input().split())
    print(m//s)
    

Coldplay codechef solution in Java

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            Scanner sc=new Scanner(System.in);
            int T=sc.nextInt();
            for(int i=0;i< T;i++){
                int m=sc.nextInt();
                int s=sc.nextInt();
                System.out.println(m/s);
            }
        }
        catch(Exception e){
            System.out.println(e);
        }
	}
}

More Codechef Solution: Click Here



Coldplay codechef solution by

Coldplay codechef solution
Coldplay codechef solution