Codeforces Manthan, Codefest 16 633A. Ebony and Ivory Solution
Problem Link: https://codeforces.com/problemset/problem/633/A
Solution in C++:
- /// La ilaha illellahu muhammadur rasulullah
- ///******Bismillahir-Rahmanir-Rahim******///
- /// Abul Hasnat Tonmoy
- /// Department of CSE,23rd batch
- /// Islamic University,Bangladesh
- ///**********ALLAH IS ALMIGHTY************///
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long a, b, c, f = 0;
- cin >> a >> b >> c;
- {
- for (int i = 0; i <= 10001; i++)
- {
- for (int j = 0; j <= 10001; j++)
- {
- if (a * i + b * j == c)
- {
- f = 1;
- break;
- }
- }
- }
- if (f == 1)
- cout << "YES" << endl;
- else
- cout << "NO" << endl;
- }
- }
No comments