80% found this document useful (5 votes)
5K views

Birthday Party - Basics of Operators & Basic Programming Practice Problems - HackerEarth

birthday party

Uploaded by

Abhishek Lahoti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
80% found this document useful (5 votes)
5K views

Birthday Party - Basics of Operators & Basic Programming Practice Problems - HackerEarth

birthday party

Uploaded by

Abhishek Lahoti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

All Tracks  Basic Programming  Operators   Problem

Birthday Party 
Attempted by: 2274 / Accuracy: 81% / Maximum Score: 20 /      48 Votes

Tag(s): Easy

PROBLEM EDITORIAL MY SUBMISSIONS

Mr. X's birthday is in next month. This time he is planning to invite N of his friends. He wants to
distribute some chocolates to all of his friends after party. He went to a shop to buy a packet of
chocolates.
At chocolate shop, each packet is having di erent number of chocolates. He wants to buy such a
packet which contains number of chocolates, which can be distributed equally among all of his
friends.
Help Mr. X to buy such a packet.

Input:
First line contains T, number of test cases.
Each test case contains two integers, N and M. where is N is number of friends and M is number
number of chocolates in a packet.

Output:
In each test case output "Yes" if he can buy that packet and "No" if he can't buy that packet.

Constraints:
1<=T<=20
1<=N<=100
1<=M<=10^5

Problem Setter:
Akash Rakshit

SAMPLE INPUT  

2
5 14
3 21

SAMPLE OUTPUT  

No
Yes

Explanation

?
Test Case 1:
There is no way such that he can distribute 14 chocolates among 5 friends equally.
Test Case 2:
There are 21 chocolates and 3 friends, so he can distribute chocolates eqally. Each friend will get 7
chocolates.

Time Limit: 1.0 sec(s) for each input le.

Memory Limit: 256 MB

Source Limit: 1024 KB

Marking Scheme: Marks are awarded when all the testcases pass.

Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino),
11
JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl,

LIVE EVENTS
PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Enter your code or Upload your code as le. Save Java 8 (oracle 1.8.0_131)  
1
2 import java.io.BufferedReader;
3 import java.io.InputStreamReader;
4
5 //import for Scanner and other utility classes
6 import java.util.*;
7
8 class TestClass {
9 public static void main(String args[] ) throws Exception {
10 Scanner s = new Scanner(System.in);
11 int T= s.nextInt();
12 for(int i=1;i<=T;i++)
13 {
14 int N = s.nextInt(); // Reading input from STDIN
15 int M = s.nextInt();
16 if(M%N==0)
17 {
18 System.out.println("Yes");
19 }
20 else
21 {
22 System.out.println("No");
23 }
24 }
25
26 }
27 }
28 22:36

 Press Ctrl-space for autocomplete suggestions.


 Provide custom input

COMPILE & TEST SUBMIT


?
Submission ID: 15080801 / 7 seconds ago

RESULT:  Accepted

Score Time (sec) Memory (KiB) Language


20.0 0.21151 64 Java 8

Time Memory Your Correct


Input Result Score Di
(sec) (KiB) Output Output

Input
 0.101817 64 0   
#1

Input
 0.109696 64 0   
#2

Compilation Log
No compilation log for this submission.

Your Rating:  Like 1 Share Tweet

COMMENTS (20)

Join Discussion...

Cancel Post

 View all comments

PROGRAMMERS WHO SOLVED THIS PROBLEM ALSO SOLVED

Sagar's Learning String Sum Help Your Roommate


Attempted By: 752 / Accuracy: 73 Attempted By: 3349 / Accuracy: 82 Attempted By: 370 / Accuracy: 79
     8 Votes     17 Votes    
 3 Votes

About Us Innovation Management

Talent Assessment University Program

Developers Wiki Blog

?
Press Careers

Reach Us

Site Language: English | Terms and Conditions | Privacy |© 2018 HackerEarth

You might also like