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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.