CF1878C.Vasilije in Cacak

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Aca and Milovan, two fellow competitive programmers, decided to give Vasilije a problem to test his skills.

Vasilije is given three positive integers: nn , kk , and xx , and he has to determine if he can choose kk distinct integers between 11 and nn , such that their sum is equal to xx .

Since Vasilije is now in the weirdest city in Serbia where Aca and Milovan live, Cacak, the problem seems weird to him. So he needs your help with this problem.

输入格式

The first line contains a single integer tt ( 1t1041 \le t \le 10^4 ) — the number of test cases.

The only line of each test case contains three integers nn , kk and xx ( 1n21051 \le n \le 2 \cdot 10^5 , 1kn1 \le k \le n , 1x410101 \le x \le 4 \cdot 10^{10} ) — the maximum element he can choose, the number of elements he can choose and the sum he has to reach.

Note that the sum of nn over all test cases may exceed 21052 \cdot 10^5 .

输出格式

For each test case output one line: "YES", if it is possible to choose kk distinct integers between 11 and nn , such that their sum is equal to xx , and "NO", if it isn't.

You can output the answer in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer).

输入输出样例

  • 输入#1

    12
    5 3 10
    5 3 3
    10 10 55
    6 5 20
    2 1 26
    187856 87856 2609202300
    200000 190000 19000000000
    28 5 2004
    2 2 2006
    9 6 40
    47202 32455 613407217
    185977 145541 15770805980

    输出#1

    YES
    NO
    YES
    YES
    NO
    NO
    YES
    NO
    NO
    NO
    YES
    YES

说明/提示

In the first test case n=5, k=3, x=10n = 5,\ k=3,\ x=10 , so we can choose the numbers: 22 , 33 , 55 , whose sum is 1010 , so the answer is "YES".

In the second test case n=5, k=3, x=3n = 5, \ k=3, \ x=3 , there is no three numbers which satisfies the condition, so the answer is "NO". It can be shown that there are no three numbers whose sum is 33 .

首页