C.cpp 532 B

12345678910111213141516171819202122232425262728293031
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int m;
  4. bool Find(int x) {
  5. if (x * (x + 1) == m) {
  6. return true;
  7. }
  8. return false;
  9. }
  10. int main() {
  11. int n;
  12. while (cin >> n) {
  13. m = n <<= 1;
  14. bool flag = false;
  15. for (int i = 1; i < sqrt(m); i++) {
  16. if (Find(i)) {
  17. flag = true;
  18. break;
  19. }
  20. }
  21. if (flag) {
  22. cout << "YES" << endl;
  23. } else {
  24. cout << "NO" << endl;
  25. }
  26. }
  27. return 0;
  28. }