問題一覧 > 通常問題

No.680 Numbers That Can Be Made

レベル : / AI推定難易度 : 1150 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 117
作問者 : 👑 tails / テスター : はむこ
お気に入りにしたユーザー ProblemId : 1776 / 自分の提出
問題文最終更新日: 2026-06-26 01:25:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 189 (順位表) の他の問題:

Problem Statement

Yuki came up with the following "way of making a number".

  • Step 1: Initially, let $s=0, t=0$.
  • Step 2: Double the value of $t$ and make it the new value of $t$ ($t := t \times 2$).
  • Step 3: Toss a coin in your mind. If it comes up heads, add $1$ to the value of $t$ and make it the new value of $t$ ($t := t+1$). You may decide whether the coin comes up heads as is convenient for you.
  • Step 4: Add the value of $t$ to the value of $s$ and make it the new value of $s$ ($s := s+t$).
  • Step 5: Roll a die in your mind. If it shows a face other than $1$, return to Step 2. You may decide the result of the die roll as is convenient for you.
  • Step 6: Output the value of $s$ as the number made, and terminate.
Given an integer $N$, determine whether $N$ can be made by the "way of making a number" above.
Output YES if it can be made, and NO if it cannot.

Input

$N$

$0 \le N \le 1000000000=10^9$
$N$ is an integer.

Output

Output YES or NO.

Sample

Sample 1
Input
10
Output
YES

We have $10=1+3+6$. Therefore, by tossing the coin suitably in Step 3 so that the values of $t$ at Step 4 are $1, 3, 6$, you can make $10$.

Sample 2
Input
12
Output
NO

It seems that $12$ cannot be made no matter what you do.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。