fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8. string s;
  9. while(t--){
  10. ll n,k,x;
  11. cin>>n>>k>>x;
  12. ll a = n-k;
  13. ll sum = (n*(n+1) - a*(a+1))/2;
  14. ll min = (k*(k+1))/2;
  15. if((sum >= x) && (min <= x)) cout<<"YES\n";
  16. else cout<<"NO\n";
  17.  
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 5324KB
stdin
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
stdout
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES