luogu#P9645. [SNCPC2019] K-hour Clock
[SNCPC2019] K-hour Clock
题目描述
A -hour clock is a day keeping method which follows the rules below:
- A day is divided into hours, where the -th hour is called the o' clock;
- If it's o'clock now, it will be o'clock after hour if ;
- If it's o'clock now, it will be o'clock after hour.
We know that it's o'clock now, and after hours it will be o'clock. What's the value of ?
输入格式
There are multiple test cases. The first line of the input is an integer (about ), indicating the number of test cases. For each test case:
The first and only line contains three integers , and (, ).
输出格式
For each test case output one line containing one integer, indicating the value of . Note that there must be . If there are multiple valid answers, you can print any of them; If there is no valid answer, print -1
(without quotes) instead.
题目大意
给定三个数 ,求一个满足 的数 ,使得 。
4
11 18 5
3 49 4
1 9 1
1 3 10
12
24
3
-1