Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t;
  6.     cin >> t;
  7.     for (int z = 0; z < t; z++)
  8.     {
  9.         int x, y, k, t, c = 0, i = 0;
  10.         cin >> x >> y >> k >> t;
  11.         while (i <= t && c < k)
  12.         {
  13.             if (x % y)
  14.             {
  15.                 x += y - (x % y);
  16.                 c++;
  17.             }
  18.             i++;
  19.         }
  20.         cout << x;
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement