Advertisement
Guest User

Wa!

a guest
May 25th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n, k,temp, maximum,remains, mod;
  8. while(cin >> n >> k)
  9. {
  10. maximum=0;
  11. remains=0;
  12. temp=n;
  13. while(temp>k)
  14. {
  15.  
  16. maximum+=temp/k;
  17. remains=temp/k;
  18. mod=temp%k;
  19. temp=remains+mod;
  20. }
  21. maximum+=n;
  22. cout << maximum << endl;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement