1352C.md (955B)
1 Source: https://codeforces.com/problemset/problem/1352/C 2 3 C. K-th Not Divisible by n 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given two positive integers $n$ and $k$. Print the $k$-th positive integer that is not divisible by $n$. 22 23 For example, if $n=3$, and $k=7$, then all numbers that are not divisible by $3$ are: $1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$. The $7$-th number among them is $10$. 24 25 Input 26 27 The first line contains an integer $t$ ($1 \le t \le 1000$) — the number of test cases in the input. Next, $t$ test cases are given, one per line. 28 29 Each test case is two positive integers $n$ ($2 \le n \le 10^9$) and $k$ ($1 \le k \le 10^9$). 30 31 Output 32 33 For each test case print the $k$-th positive integer that is not divisible by $n$. 34 35 Example 36 37 Input 38 39 ``` 40 6 41 3 7 42 4 12 43 2 1000000000 44 7 97 45 1000000000 1000000000 46 2 1 47 ``` 48 49 Output 50 51 ``` 52 10 53 15 54 1999999999 55 113 56 1000000001 57 1 58 ```