josiftepe

Untitled

Nov 15th, 2020
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int a;
  8.     int b;
  9.     int k;
  10.     int y = 0;
  11.     cin>>k;
  12.     cin>>a;
  13.     cin>>b;
  14.     int x=0;
  15.  
  16.     if(a>b){
  17.         cout<<"NE";
  18.     }
  19.     if(a==b){
  20.         cout<<"NE";
  21.     }
  22.  
  23.     if(a<b){
  24.         while(k>=x){
  25.             k+=a;
  26.             x+=b;
  27.             y+=1;
  28.             if(x>=k){
  29.                 break;
  30.             }
  31.         }
  32.     }
  33.  
  34.     if (x==k){
  35.         cout<<y<<endl;
  36.          
  37.     }
  38.     if (x>k){
  39.         cout<<"NE";
  40.     }
  41.  
  42.  
  43.  
  44.  
  45.  
  46.     return 0;
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment