Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef has two integers A and B (A≤B).
Chef can choose any non-negative integer X and add them to both A and B. Find whether it is possible to make A a divisor of B.
For each test case, output YES
if it is possible to make A a factor of BB, NO
otherwise.
You can print each character of the string in uppercase or lowercase. For example, the strings Yes
, YES
, yes
, and yEs
, are all considered identical.
Input:
3
3 6
4 14
9 10
Output:
YES
YES
NO
Test case 1: We can choose X=0 and add them to 3 and 6. Thus, 3 is a factor of 6.
Test case 2: We can choose X=1 and add them to 4 and 14. Thus, 4+1=5 is a factor of 14+1=15.
Test case 3: There is no possible value of X to add such that A becomes a factor of B.
# cook your dish here
T=int(input())
for i in range(T):
a,b=map(int,input().split())
x=b-a
if x<a and x!=0:
print("NO")
else:
print("YES")
/* 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
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0)
{
int a = sc.nextInt();
int b = sc.nextInt();
if(b%a==0||b-a>a)
{
System.out.println("YES");
}
else
System.out.println("NO");
}
}
}
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
int flag=1;
while(t--){
int a,b;
cin>>a>>b;
if(b%a==0){
cout<<"YES"<<endl;
}
else if((b/a)>1){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
return 0;
}
In our experience, we suggest you solve this Make Multiple CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Make Multiple CodeChef Solution
I hope this Make Multiple CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>