307401: CF1352C. K-th Not Divisible by n

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:27 Solved:0

Description

K-th Not Divisible by n

题意翻译

### 题目描述 给定两个正整数 $n$ 和 $k$。求出第 $k$ 个不能被 $n$ 整除的正整数。 例如,如果 $n=3$,$k=7$,那么所有不能被 $3$ 整除的数为:$1,2,4,5,7,8,10,11,13 \ldots$ 在这其中的第 $7$ 个数字为 $10$。 ### 输入格式 **本题有多组数据** 第一行包括一个整数 $t$ $(1 \leq t \leq 1000)$,表示数据的组数。 接下来的 $t$ 行,每行两个正整数 $n$ $(2 \leq n \leq 10^9)$ 和 $k$ $(1 \leq k \leq 10^9)$。 ### 输出格式 对于每一组数据,输出第 $k$ 个不能被 $n$ 整除的正整数。

题目描述

You are given two positive integers $ n $ and $ k $ . Print the $ k $ -th positive integer that is not divisible by $ n $ . 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 $ .

输入输出格式

输入格式


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. Each test case is two positive integers $ n $ ( $ 2 \le n \le 10^9 $ ) and $ k $ ( $ 1 \le k \le 10^9 $ ).

输出格式


For each test case print the $ k $ -th positive integer that is not divisible by $ n $ .

输入输出样例

输入样例 #1

6
3 7
4 12
2 1000000000
7 97
1000000000 1000000000
2 1

输出样例 #1

10
15
1999999999
113
1000000001
1

Input

题意翻译

### 题目描述 给定两个正整数 $n$ 和 $k$。求出第 $k$ 个不能被 $n$ 整除的正整数。 例如,如果 $n=3$,$k=7$,那么所有不能被 $3$ 整除的数为:$1,2,4,5,7,8,10,11,13 \ldots$ 在这其中的第 $7$ 个数字为 $10$。 ### 输入格式 **本题有多组数据** 第一行包括一个整数 $t$ $(1 \leq t \leq 1000)$,表示数据的组数。 接下来的 $t$ 行,每行两个正整数 $n$ $(2 \leq n \leq 10^9)$ 和 $k$ $(1 \leq k \leq 10^9)$。 ### 输出格式 对于每一组数据,输出第 $k$ 个不能被 $n$ 整除的正整数。

加入题单

算法标签: