Codeforces Manthan, Codefest 16 633A. Ebony and Ivory Solution


  

 Problem Link: https://codeforces.com/problemset/problem/633/A

Solution in C++:

  1. /// La ilaha illellahu muhammadur rasulullah
  2. ///******Bismillahir-Rahmanir-Rahim******///
  3. /// Abul Hasnat Tonmoy
  4. /// Department of CSE,23rd batch
  5. /// Islamic University,Bangladesh
  6. ///**********ALLAH IS ALMIGHTY************///
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. int main()
  10. {
  11. long long a, b, c, f = 0;
  12. cin >> a >> b >> c;
  13. {
  14. for (int i = 0; i <= 10001; i++)
  15. {
  16. for (int j = 0; j <= 10001; j++)
  17. {
  18. if (a * i + b * j == c)
  19. {
  20. f = 1;
  21. break;
  22. }
  23. }
  24. }
  25.  
  26. if (f == 1)
  27. cout << "YES" << endl;
  28. else
  29. cout << "NO" << endl;
  30. }
  31. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.