当前位置: 首页 > 工具软件 > donut > 使用案例 >

Donut Shops

顾昊穹
2023-12-01

A. Donut Shops

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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 109109. It can be shown that under the given constraints such values always exist if any values exist at all.

Input

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

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

Output

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 109109.

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

Example

input

Copy

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

output

Copy

-1 20
8 -1
1 2
-1 1000000000

Note

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 109109 donuts cost 10181018 dollars in the first shop and 109109 dollars in the second shop.

思路:对于第一个店,如果买一个比在第二个店买一盒还贵,那么输出-1,反之输出1

对于第二个店,如果买一盒比在第一个店买b个还贵,那么就输出-1,反之输出b

#include<iostream>
using namespace std;

void solved()
{
    long long a,b,c;
    cin>>a>>b>>c;
    if(a>=c) cout<<-1<<" ";
    else cout<<1<<" ";
    if(c>=a*b) cout<<-1<<endl;
    else cout<<b<<endl;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        solved();
    }
    return 0;
}

 类似资料:

相关阅读

相关文章

相关问答