josiftepe

Untitled

Oct 25th, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.    int m;
  8.    int d;
  9.    int n;
  10.    int x=0;
  11.    int y=0;
  12.  
  13.    cin>>m;
  14.    cin>>d;
  15.    cin>>n;
  16.  
  17.    while(m >= x){
  18.     x +=d;
  19.        y+=1;
  20.        if(x >= m){
  21.            break;
  22.        }
  23.     x-=n;
  24.        
  25.    
  26.    }
  27.  
  28.    cout<<y;
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment