103241: [Atcoder]ABC324 B - 3-smooth Numbers

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

Description

Score : $200$ points

Problem Statement

You are given a positive integer $N$. If there are integers $x$ and $y$ such that $N=2^x3^y$, print Yes; otherwise, print No.

Constraints

  • $1\leq N\leq10^{18}$
  • $N$ is an integer.

Input

The input is given from Standard Input in the following format:

$N$

Output

Print a single line containing Yes if there are integers $x$ and $y$ that satisfy the condition, and No otherwise.


Sample Input 1

324

Sample Output 1

Yes

For $x=2,y=4$, we have $2^x3^y=2^23^4=4\times81=324$, so the condition is satisfied. Thus, you should print Yes.


Sample Input 2

5

Sample Output 2

No

There are no integers $x$ and $y$ such that $2^x3^y=5$. Thus, you should print No.


Sample Input 3

32

Sample Output 3

Yes

For $x=5,y=0$, we have $2^x3^y=32\times1=32$, so you should print Yes.


Sample Input 4

37748736

Sample Output 4

Yes

Output

分数:200分

问题描述

给你一个正整数$N$。如果存在整数$x$和$y$使得$N=2^x3^y$,则打印Yes;否则,打印No

约束条件

  • $1\leq N\leq10^{18}$
  • $N$是一个整数。

输入

输入从标准输入以以下格式给出:

$N$

输出

如果有满足条件的整数$x$和$y$,则打印一行Yes,否则打印No


样例输入1

324

样例输出1

Yes

对于$x=2,y=4$,我们有$2^x3^y=2^23^4=4\times81=324$,因此条件得到满足。因此,你应该打印Yes


样例输入2

5

样例输出2

No

不存在整数$x$和$y$使得$2^x3^y=5$。因此,你应该打印No


样例输入3

32

样例输出3

Yes

对于$x=5,y=0$,我们有$2^x3^y=32\times1=32$,因此你应该打印Yes


样例输入4

37748736

样例输出4

Yes

HINT

$N=2^x3^y$是否成立?

加入题单

算法标签: