300243: CF47A. Triangular numbers
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Triangular numbers
题意翻译
### 题面描述 给定一个数 $n$,问你是否存在一个整数 $i$,满足 $\frac{i\times (i+1)}{2}=n$。 若存在,输出`YES`,否则输出`NO`. ### 数据范围与约定 $1 \leq n \leq 500$题目描述
A triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The $ n $ -th triangular number is the number of dots in a triangle with $ n $ dots on a side. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF47A/7344b4fd5acb7c973775cffc0c5a51a81c6ee4d9.png). You can learn more about these numbers from Wikipedia (http://en.wikipedia.org/wiki/Triangular\_number). Your task is to find out if a given integer is a triangular number.输入输出格式
输入格式
The first line contains the single number $ n $ ( $ 1<=n<=500 $ ) — the given integer.
输出格式
If the given integer is a triangular number output YES, otherwise output NO.
输入输出样例
输入样例 #1
1
输出样例 #1
YES
输入样例 #2
2
输出样例 #2
NO
输入样例 #3
3
输出样例 #3
YES