Vasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations:

  • multiply the current number by 2 (that is, replace the number x by 2·x);
  • append the digit 1 to the right of current number (that is, replace the number x by 10·x + 1).

You need to help Vasily to transform the number a into the number b using only the operations described above, or find that it is impossible.

Note that in this task you are not required to minimize the number of operations. It suffices to find any way to transform a into b.

Input

The first line contains two positive integers a and b (1 ≤ a < b ≤ 109) — the number which Vasily has and the number he wants to have.

Output

If there is no way to get b from a, print "NO" (without quotes).

Otherwise print three lines. On the first line print "YES" (without quotes). The second line should contain single integer k — the length of the transformation sequence. On the third line print the sequence of transformations x1, x2, ..., xk, where:

  • x1 should be equal to a,
  • xk should be equal to b,
  • xi should be obtained from xi - 1 using any of two described operations (1 < i ≤ k).

If there are multiple answers, print any of them.

Examples
input
2 162
output
YES
5
2 4 8 81 162
input
4 42
output
NO
input
100 40021
output
YES
5
100 200 2001 4002 40021

题意:就是从a变成b(*2或者的*10+1),可以就输出具体变化

解法:额。。搜索一下嘛

 #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
using namespace std;
int a[];
long long n,m;
int flag;
int cnt;
void dfs(int cnt,long long x){ a[cnt]=x;
if(x>m){
return;
}
if(x==m&&flag==){
flag=;
cout<<"YES"<<endl;
cout<<cnt<<endl;
for(int i=;i<=cnt;i++){
cout<<a[i]<<" ";
}
}
dfs(cnt+,x*+);
dfs(cnt+,x*);
}
int main(){
cin>>n>>m;
dfs(,n);
if(flag==){
cout<<"NO"<<endl;
}
return ;
}

最新文章

  1. JSON.stringify的使用方法
  2. JBoss和Tomcat版本、及Servlet、JSP规范版本对应一览 【转】
  3. 解决PowerDesigner 生成Sql2005-2012 找不到sysproperties表的问题
  4. Redis Key 命令
  5. ADO.NET笔记——利用Command对象的ExecuteScalar()方法返回一个数据值
  6. SQLServer 触发器 同时插入多条记录有关问题
  7. Hadoop家族学习路线图
  8. weapon制作武器
  9. redis 缓存技术与memcache的最大差别
  10. SQLite数据库框架ORMLite与GreenDao的简单比较
  11. css3盒子相关样式
  12. 从canvas理解面向对象
  13. windows,分割路径.得出目录
  14. 增值税发票 成都金锐发票IC卡读入
  15. python基础 字典练习
  16. e-olymp Problem11 Big accuracy
  17. 限定某个目录禁止解析php 限制user_agent php相关配置
  18. Python 线程调用
  19. (精)AVL树旋转共8种情况(涵盖所有考研的范围)
  20. Git系统学习网址

热门文章

  1. css中IE判断语句 if !IE
  2. codeforces C. New Year Ratings Change 解题报告
  3. Django_model进阶
  4. 限制远程桌面登录IP的方法
  5. JavaScript Constructors
  6. Java丨时间判断谁前谁后
  7. P2759 奇怪的函数
  8. 点分治 [IOI2011]Race
  9. .NETFramework:StaticValueInjecter
  10. Request.UrlReferrer 实现页面刷新