C Game"23"

#include<iostream>
using namespace std;
int main()
{
long long n,m;
long k;
cin>>n>>m;
while(n*m!=0){
k=m/n;
int ans=0;
while(k%2==0){
ans++;
k/=2;
}
while(k%3==0){
ans++;
k/=3;
}
if(m==n){
cout<<0<<endl;
return 0;
}
if(m%n!=0)
{
cout<<-1<<endl;
return 0;
}
if(k!=1)
{
cout<<-1<<endl;
return 0;
}
cout<<ans<<endl;
return 0;
}
} 这里面可以先相除
然后使用k=2x+3y;
然后就可以出来了!

codeforces-3的更多相关文章

  1. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  2. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  3. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  4. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  5. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  6. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  7. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

  8. CodeForces - 696B Puzzles

    http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...

  9. CodeForces - 148D Bag of mice

    http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...

  10. CodeForces - 453A Little Pony and Expected Maximum

    http://codeforces.com/problemset/problem/453/A 题目大意: 给定一个m面的筛子,求掷n次后,得到的最大的点数的期望 题解 设f[i]表示掷出 <= ...

随机推荐

  1. Windows的四类消息

    Windows的三类消息1.标准消息宏名称 对映消息 消息处理函数(名称已由系统预设)ON_WM_CHAR WM_CAHR OnCharON_WM_CLOSE WM_CLOSE OnCloseON_W ...

  2. [P3676]小清新数据结构题

    Description: 给你一棵树,每次询问以一个点为根时所有子树点权和的平方和 带修改 Hint: \(n\le 2*10^5\) Solution: 这题只要推出式子就很简单了 如果不换根这个平 ...

  3. You must configure either the server or JDBC driver (via the serverTimezone configuration property

    使用JDBC连接MySql时出现:The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one ...

  4. 08-Xml & Tomcat

    Xml & Tomcat Xml >eXtendsible   markup  language     可扩展的标记语言 XML  有什么用? 1. 可以用来保存数据 2. 可以用来做 ...

  5. apt-get安装mysql

    1,检查是否已安装. 2,安装: apt-get install mysql-client-core-5.5 apt-get install mysql-server mysql-client 安装过 ...

  6. Red hat查找命令所属的rpm包

    当安装命令软件包时,很多时候命令名不一定就是软件包的名字 如scp命令,其命令名就和软件包名字不一样,直接安装会失败: #yum install scp .... Trying other mirro ...

  7. less 基础+ flex

    1.less 中的变量 @ 符号 引入 /*普通变量*/ @color:pinker; .styles{ color:@color; } /*选择器变量*/ @I:img; @{I}{ width: ...

  8. CSS3属性上调

    一.为什么使用CSS 1.有效的传递页面信息 2.使用CSS美化过的页面文本,使页面漂亮.美观,吸引用户 3.可以很好的突出页面的主题内容,使用户第一眼可以看到页面主要内容 4.具有良好的用户体验 二 ...

  9. 火狐浏览器安装firebug和firepath插件方法(离线)

    1.下载FF55以内版本安装包,安装后在Firefox 更新选择"不检查更新" 2.火狐浏览器各个版本下载地址:http://ftp.mozilla.org/pub/firefox ...

  10. 自动化脚本测试,postman使用沉淀

    // 服务器地址 var server = 'XXXXXXXXXXXX'; //秘钥Key var secretKey = 'XXXXXXXXXXXX'; //获取当前时间 function crea ...