Advertisement
Josif_tepe

Untitled

Feb 17th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int K, A, B;
  7.     cin >> K >> A >> B;
  8.     int rezultat = -1;
  9.     for(int den = 0; den <= 10000; den++) {
  10.         if(K + den * A == B * den) {
  11.             rezultat = den;
  12.             break;
  13.         }
  14.     }
  15.     if(rezultat == -1) {
  16.         cout << "NE" << endl;
  17.     }
  18.     else {
  19.         cout << rezultat << endl;
  20.     }
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement