CF1373A.Donut Shops

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are two rival donut shops.

The first shop sells donuts at retail: each donut costs aa dollars.

The second shop sells donuts only in bulk: box of bb donuts costs cc dollars. So if you want to buy xx donuts from this shop, then you have to buy the smallest number of boxes such that the total number of donuts in them is greater or equal to xx.

You want to determine two positive integer values:

  1. how many donuts can you buy so that they are strictly cheaper in the first shop than in the second shop?
  2. how many donuts can you buy so that they are strictly cheaper in the second shop than in the first shop?

If any of these values doesn't exist then that value should be equal to −1-1. If there are multiple possible answers, then print any of them.

The printed values should be less or equal to 10910^9. It can be shown that under the given constraints such values always exist if any values exist at all.

有两家竞争的甜甜圈店。

第一家店以零售方式出售甜甜圈:每个甜甜圈售价为 aa 美元。

第二家店仅以批发方式出售甜甜圈:每盒含 bb 个甜甜圈,售价为 cc 美元。因此,若你想从该店购买 xx 个甜甜圈,则必须购买最小数量的盒子,使得这些盒子中甜甜圈的总数大于或等于 xx。

你需要确定两个正整数:

  1. 购买多少个甜甜圈时,在第一家店购买严格比在第二家店购买更便宜?
  2. 购买多少个甜甜圈时,在第二家店购买严格比在第一家店购买更便宜?

如果其中任一值不存在,则该值应为 −1-1。若存在多个可能的答案,输出任意一个即可。

所输出的值必须小于或等于 10910^9。可以证明:在给定约束条件下,只要存在满足条件的值,就一定存在不超过 10910^9 的解。

输入格式

The first line contains a single integer tt (1≤t≤10001 \le t \le 1000) — the number of testcases.

Each of the next tt lines contains three integers aa, bb and cc (1≤a≤1091 \le a \le 10^9, 2≤b≤1092 \le b \le 10^9, 1≤c≤1091 \le c \le 10^9).

第一行包含一个整数 tt(1≤t≤10001 \le t \le 1000)—— 表示测试用例的数量。

接下来的 tt 行中,每行包含三个整数 aa、bb 和 cc(1≤a≤1091 \le a \le 10^9,2≤b≤1092 \le b \le 10^9,1≤c≤1091 \le c \le 10^9)。

输出格式

For each testcase print two positive integers. For both shops print such xx that buying xx donuts in this shop is strictly cheaper than buying xx donuts in the other shop. xx should be greater than 00 and less or equal to 10910^9.

If there is no such xx, then print −1-1. If there are multiple answers, then print any of them.

对每个测试用例,输出两个正整数。对两家商店分别输出一个满足如下条件的 xx:在该商店购买 xx 个甜甜圈的价格严格低于在另一家商店购买 xx 个甜甜圈的价格。xx 应满足大于 00 且小于等于 10910^9。

若不存在这样的 xx,则输出 −1-1。若存在多个满足条件的 xx,则输出任意一个即可。

输入输出样例

  • 输入#1

    4
    5 10 4
    4 5 20
    2 2 3
    1000000000 1000000000 1000000000

    输出#1

    -1 20
    8 -1
    1 2
    -1 1000000000

说明/提示

In the first testcase buying any number of donuts will be cheaper in the second shop. For example, for 33 or 55 donuts you'll have to buy a box of 1010 donuts for 44 dollars. 33 or 55 donuts in the first shop would cost you 1515 or 2525 dollars, respectively, however. For 2020 donuts you'll have to buy two boxes for 88 dollars total. Note that 33 and 55 are also valid answers for the second shop, along with many other answers.

In the second testcase buying any number of donuts will be either cheaper in the first shop or the same price. 88 donuts cost 3232 dollars in the first shop and 4040 dollars in the second shop (because you have to buy two boxes). 1010 donuts will cost 4040 dollars in both shops, so 1010 is not a valid answer for any of the shops.

In the third testcase 11 donut costs 22 and 33 dollars, respectively. 22 donuts cost 44 and 33 dollars. Thus, 11 is a valid answer for the first shop and 22 is a valid answer for the second shop.

In the fourth testcase 10910^9 donuts cost 101810^{18} dollars in the first shop and 10910^9 dollars in the second shop.

在第一个测试用例中,在第二家店购买任意数量的甜甜圈都更便宜。例如,购买 33 个或 55 个甜甜圈时,你必须购买一盒 1010 个的甜甜圈,花费 44 美元。而在第一家店,33 个或 55 个甜甜圈分别需花费 1515 美元或 2525 美元。对于 2020 个甜甜圈,你必须购买两盒,总共花费 88 美元。注意,除了许多其他答案外,33 和 55 也是第二家店的有效答案。

在第二个测试用例中,在第一家店购买任意数量的甜甜圈都更便宜或价格相同。88 个甜甜圈在第一家店花费 3232 美元,在第二家店花费 4040 美元(因为你必须购买两盒)。1010 个甜甜圈在两家店均花费 4040 美元,因此 1010 对任何一家店都不是有效答案。

在第三个测试用例中,11 个甜甜圈的价格分别为 22 美元和 33 美元;22 个甜甜圈的价格分别为 44 美元和 33 美元。因此,11 是第一家店的有效答案,而 22 是第二家店的有效答案。

在第四个测试用例中,10910^9 个甜甜圈在第一家店花费 101810^{18} 美元,在第二家店花费 10910^9 美元。

输入解题思路,AI测评打分。不知道怎么写?

首页