#P15739. [JAG 2024 Summer Camp #2] K-th Nondivisor

[JAG 2024 Summer Camp #2] K-th Nondivisor

题目描述

Process QQ queries. The ii-th query is as follows:

  • Given integers LiL_i, RiR_i, and KiK_i, find the KiK_i-th smallest positive integer xx such that xx does not divide any of the integers from LiL_i to RiR_i (inclusive).

输入格式

The input is given in the following format:

$$\begin{aligned} &Q \\ &L_1 \ R_1 \ K_1 \\ &\vdots \\ &L_Q \ R_Q \ K_Q \end{aligned} $$
  • 1Q100,0001 \leq Q \leq 100,000
  • 1LiRi200,0001 \leq L_i \leq R_i \leq 200,000
  • 1Ki200,0001 \leq K_i \leq 200,000
  • All input values are integers.

输出格式

Output QQ lines. On the ii-th line, output the answer for the ii-th query.

3
10 11 5
12345 23456 789
1 200000 200000
8
23629
400000