codeforces-3
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的更多相关文章
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- CodeForces - 696B Puzzles
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
- CodeForces - 148D Bag of mice
http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...
- CodeForces - 453A Little Pony and Expected Maximum
http://codeforces.com/problemset/problem/453/A 题目大意: 给定一个m面的筛子,求掷n次后,得到的最大的点数的期望 题解 设f[i]表示掷出 <= ...
随机推荐
- BZOJ 5104
这个模数比较有趣 可以求出 $\sqrt{5}$ 然后就可以做了 $f_n=\dfrac{\sqrt{5}}{5}[(\dfrac{\sqrt{5}+1}{2})^n-(\dfrac{1-\sqrt{ ...
- mysql Navicat 导入导出
1.导出数据库: 打开Navicat ,在我们要导出的数据库上右击鼠标,然后弹出的快捷菜单上点击“转储SQL 文件”,(有些版本, 会有子菜单,在再次弹出的子菜单项中选择第一个“数据跟结构”) ...
- django缓存、信号、序列化
本篇导航: Django的缓存机制 Django的信号 Django的序列化 一.Django的缓存机制 1.缓存介绍 1)缓存的简介 在动态网站中,用户所有的请求,服务器都会去数据库中进行相应的增, ...
- __x__(20)0907第四天__列表ul,ol,dl
列表分为: 有序列表 ul: <ul type="disc"> <li>张三</li> <li>李四</li> < ...
- ECMA Script 6_字符串_扩展_字符 是4字节还是2字节?_模板字符串
ES6 字符串扩展 ES6 加强了对 Unicode 的支持,并且扩展了字符串对象 字符 的 Unicode 表示法 允许采用 \uxxxx 形式表示一个字符, 其中 xxxx 表示字符的 Unico ...
- Python基础之集合
一.定义: 二.基本操作: 三.运算: 交集&, 并集|, 补集-, 对称补集^, 子集< 超集> 四.集合推导式: 五.固定集合 frozenset 六.基本代码: # 1. ...
- java学习(四)--- String 、StringBuffer、StringBuilder 和 数组
对于 String.StringBuffer.StringBuilder比较一下 主要说说三者的不同 String 长度大小不可变 StringBuffer 和 StringBuilder 长度可变 ...
- linux中安装python+selenium+chrome
- Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Unable to compile class for JSP] with root cause java.lang.IllegalArgumentException: Page directive: inval
严重: Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Una ...
- 隐藏状态栏,toolbar前面空格问题,editText圆角
EditText圆角: 一.在drawable下面添加xml文件rounded_editview.xml 复制代码 代码如下: <?xml version="1.0" enc ...