301016: CF192A. Funky Numbers

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Funky Numbers

题意翻译

# 题目描述 今年最时髦的数字是三角数(即可表示为![](https://cdn.luogu.org/upload/vjudge_pic/CF192A/b7835ec12be1f62e2540332b68d58fb7ebe6c923.png)的数字,其中k是正整数),而今年最酷的数字是那些可表示为两个三角数之和的数字。 著名的嬉皮士安德烈崇拜一切酷而时髦的东西。但不幸的是,他不擅长数学。给定一个数字n,请帮助他确定这个数字是否能够由两个三角形数的和来表示。(两个三角数可以相同) # 输入输出格式 ## 输入格式: 一行,一个数n(1<=n<=10^9)。 ## 输出格式: 输出这个数是否满足安德烈的要求。如果是,输出“YES”,否则输出“NO”。

题目描述

As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF192A/b7835ec12be1f62e2540332b68d58fb7ebe6c923.png), where $ k $ is some positive integer), and the coolest numbers are those that are representable as a sum of two triangular numbers. A well-known hipster Andrew adores everything funky and cool but unfortunately, he isn't good at maths. Given number $ n $ , help him define whether this number can be represented by a sum of two triangular numbers (not necessarily different)!

输入输出格式

输入格式


The first input line contains an integer $ n $ ( $ 1<=n<=10^{9}) $ .

输出格式


Print "YES" (without the quotes), if $ n $ can be represented as a sum of two triangular numbers, otherwise print "NO" (without the quotes).

输入输出样例

输入样例 #1

256

输出样例 #1

YES

输入样例 #2

512

输出样例 #2

NO

说明

In the first sample number ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF192A/4cb9109ae81f8a893fe062b72141c5fdcad6da49.png). In the second sample number $ 512 $ can not be represented as a sum of two triangular numbers.

Input

题意翻译

# 题目描述 今年最时髦的数字是三角数(即可表示为![](https://cdn.luogu.org/upload/vjudge_pic/CF192A/b7835ec12be1f62e2540332b68d58fb7ebe6c923.png)的数字,其中k是正整数),而今年最酷的数字是那些可表示为两个三角数之和的数字。 著名的嬉皮士安德烈崇拜一切酷而时髦的东西。但不幸的是,他不擅长数学。给定一个数字n,请帮助他确定这个数字是否能够由两个三角形数的和来表示。(两个三角数可以相同) # 输入输出格式 ## 输入格式: 一行,一个数n(1<=n<=10^9)。 ## 输出格式: 输出这个数是否满足安德烈的要求。如果是,输出“YES”,否则输出“NO”。

加入题单

上一题 下一题 算法标签: