http://codeforces.com/contest/47
A
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define maxn 1000005 8 typedef long long ll; 9 typedef unsigned long long ull; 10 11 12 13 14 int main(){ 15 #ifndef ONLINE_JUDGE 16 // freopen("input.txt","r",stdin); 17 #endif 18 std::ios::sync_with_stdio(false); 19 map<int,int>mp; 20 for(int i=1;i<=500;i++){ 21 mp[i*(i+1)/2]=1; 22 } 23 int n; 24 cin>>n; 25 if(mp[n]) cout<<"YES"<<endl; 26 else cout<<"NO"<<endl; 27 28 }