Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
385 B
571
Indexable
Never
#include<iostream> 

using namespace std; 
	
bool Check_Per(int n){  
	long long int sum = 0;
	if(n < 6){ 
		return false;
	}  
	for(long long int i = 1; i <= n; i++){ 
		sum += i; a
		if(sum == n){ 
			return true;
		}
	}
	return false;
}
int main(){ 
	long long int n; 
	cin >> n;
	if(Check_Per(n)){ 
		cout << "YES";
	}else{ 
		cout << "NO";
	}
return 0;
}