#C. C.数字找朋友

    Type: Default 1000ms 256MiB

C.数字找朋友

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

img

玛卡巴卡想知道是否能通过数字 aa 找到数字 bb

Description

给定起始数字 a (1<=a<=105)a \ (1<=a<=10^5) 还有终止数字 b (0<=b<=108)b \ (0<=b<=10^8) 我们现在有三种操作方法:

  • 给当前的数字 xx 乘3
  • 给当前的数字 xx 乘5
  • 给当前的数字 xx 除7 (向下取整)

如果十步之内(包含第十步)我们发现能从数字 aa 最后到达数字 bb 并且在操作的过程中都是 正整数 ,那么就输出 YES 否则输出 NO

Format

Input

输入数字 ab (1<=a<=105,0<=b<=108)a,b \ (1<=a<=10^5,0<=b<=10^8)

Output

如果能十步内到达则输出 YES否则输出NO

Samples

5 65
YES
14 982
NO

Limitation & hint

对于样例1来说: 我们可以通过如下操作得到 bb : $a->(a \times 3 = 15) - > (a \times 3 = 45) - > (a \times 5 = 225) -> (a / 7 = 32) -> (a \times 3 = 96) - > (a / 7 = 13) -> (a \times 5 = 65)$

1s, 2048KiB for each test case.

SWPU第二届天梯选拔赛暨蓝桥杯训练赛

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
7
Start at
2022-3-17 14:30
End at
2022-3-17 17:30
Duration
3 hour(s)
Host
Partic.
158