CF192A.Funky Numbers

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , 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)!

众所周知,今年最时髦的数被称为“三角形数”(即可以表示为 的整数,其中 kk 为某个正整数),而最酷的数则是那些可以表示为两个三角形数之和的数。

一位知名潮人安德鲁(Andrew)热爱一切时髦又酷炫的事物,但不幸的是,他不擅长数学。给定一个数 nn,请帮助他判断该数是否能表示为两个三角形数之和(这两个三角形数可以相同)!

输入格式

The first input line contains an integer n (1 ≤ n ≤ 109).

第一行输入包含一个整数 nn(1≤n≤1091 \leq n \leq 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).

如果 n 可以表示为两个三角形数之和,则输出 "YES"(不带引号),否则输出 "NO"(不带引号)。

输入输出样例

  • 输入#1

    256

    输出#1

    YES
  • 输入#2

    512

    输出#2

    NO

说明/提示

In the first sample number .

In the second sample number 512 can not be represented as a sum of two triangular numbers.

在第一个样例中,数字为 。

在第二个样例中,数字 512 无法表示为两个三角形数之和。

输入解题思路,AI测评打分。不知道怎么写?

首页