EJMAR21G - EDITORIAL

PROBLEM LINK:

Practice
Contest

Author: sid_rasa
Tester: akay_99
Editorialist: sid_rasa

DIFFICULTY:

EASY

PREREQUISITES:

Math

PROBLEM:

Given a health M, check if it is a multiple of health N.

QUICK EXPLANATION:

Check if the remainder is 0.

EXPLANATION:

A number is a multiple of other number if it is completely divisible i.e, when divided it produces a remainder zero. The modulo operation β€œ%” is used here to calculate the remainder.

TIME COMPLEXITY

O(1) i.e, constant time as the time taken doesn’t depend upon the input.

SOLUTIONS:

Setter's Solution
#include <iostream>
using namespace std;

int main()
{
    int testCases;
    cin >> testCases;
    while (testCases--)
    {
        int N, M;
        cin >> N >> M;
        if (M % N == 0)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}
Tester's Solution
`for i in range(int(input())):
    a,b=map(int,input().split())
    ans= 'YES' if b%a==0 else 'NO'
    print(ans)`
1 Like