a53

Excursie0

a53
Dec 27th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int z,pb,b,pt,t;
  7. cin>>z>>pb>>b>>pt>>t;
  8. for(int i=1;i<=z;i++)
  9. {
  10. pb+=b;
  11. pt+=t;
  12. if(pb==pt)
  13. {
  14. cout<<pb;
  15. return 0;
  16. }
  17. }
  18. cout<<-1;
  19. }
Add Comment
Please, Sign In to add comment