Make the Multiple

·

1 min read

This is article is writeup of a question named make multiple from codechef contest starters 62.https://www.codechef.com/START62D?order=desc&sortBy=successful_submissions

It took nearly 1.5 hrs for my brain to try to solve this easy peasy question,but then also i failed.Read the question from above link, this question was purely based on number theory and common sense.

Concept ->

if we choose any number say X then difference between (A+X) & (B+X) will remain same . if A & B are same then answer is obviously YES.But for A & B such that there difference (B-A) if less than A then answer is NO.

proof for above bolded sentence ->

proof.jpeg

proof2.jpeg

code ->

#include <stdio.h>

int main(void) {
    // your code goes here
    int t;
    scanf("%d",&t);

    while(t--){

        int a,b;
        scanf("%d %d\n",&a,&b);

        if(a%b == 0 || (b-a) >= a){
            printf("YES\n");
        }else{
            printf("NO\n");
        }

    }
    return 0;
}