Skip to content

Instantly share code, notes, and snippets.

@modos
Created March 23, 2023 06:52
Show Gist options
  • Save modos/9f848df74bf7460fdc67dcc573fcc684 to your computer and use it in GitHub Desktop.
Save modos/9f848df74bf7460fdc67dcc573fcc684 to your computer and use it in GitHub Desktop.
AbulHassan’s Quest
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin >> T;
for(int test = 0; test < T; test++)
{
int a, b, r;
cin >> a >> b >> r;
if(b == 0)
cout << (a == r?"Yes\n":"No\n");
else
cout << ((a-r)%b == 0?"Yes\n":"No\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment