logo AlgoBeat OnlineJudge
登录 注册

#208806. [ICPC 2022 Xi'an R] Clone Ranran

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Ranran needs to prepare a contest! A contest is made of problems, and Ranran can do one of the following two things:

  • Clone himself in minutes. That is, after minutes, there will be one more Ranran.
  • Prepare a problem in minutes. That is, after minutes, there will be one more problem.

Note that a cloned Ranran can also do the two things above. A Ranran cannot do the two things at the same time.

Ranran wants to prepare the contest as fast as possible. But he is very lazy, so he asks you to find the minimum number of minutes to prepare the contest.

You need to answer queries independently.

输入格式

The first line contains an integer ().

Each of the next lines contains three integers , and (), representing a query.

输出格式

For each test case, output a line with a single integer representing the answer.

样例

样例输入 1

5
1 1 1
2 3 3
9 9 9
3 26 47
1064 822 1048576

样例输出 1

1
7
45
44
21860

数据范围与提示

Source: The 2022 ICPC Asia Xi'an Regional Contest Problem C.

Author: MagicSpark.