Advertisement
Niloy007

K-th Not Divisible by n || Codeforces

May 10th, 2020
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int t, n, k;
  6.     cin >> t;
  7.     while(t--) {
  8.         cin >> n >> k;
  9.         double div = (k - 1) / (double) (n - 1);
  10.         int result = k + floor(div);
  11.         cout << result << endl;;
  12.     }
  13.  
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement