fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long ll;
  5. typedef double dl;
  6.  
  7. #define endl "\n"
  8. #define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  9. #define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
  10.  
  11. int main()
  12. {
  13. optimize();
  14. ll t;
  15. cin >> t;
  16. while(t--)
  17. {
  18. ll n,k,x;
  19. cin >> n >> k >> x;
  20. ll p = ((k+1)*k)/2;
  21. ll r = (((n+1)*n) - ((n-k)*(n-k+1)))/2;
  22. if(x>= p && x<=r)
  23. {
  24. cout << "YES" << endl;
  25. }
  26. else
  27. cout <<"NO"<<endl;
  28. }
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 5320KB
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