反正n不大,就从1开始枚举咯~
code:
#include <map>
#include <queue>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
bool judge(int n)
{
for(int i=1;;i++)
{
if(i*(i+1)/2==n)return true;
if(i*(i+1)/2 >n)return false;
}
return false;
}
int main()
{
int n; cin>>n;
cout<< (judge(n)?"YES":"NO")<<endl;
return 0;
}