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]表示掷出 <= ...
随机推荐
- 推荐常用的移动端、PC端、小程序的UI框架
1.移动端UI库 ①.Vant UI 官方地址:https://youzan.github.io/vant/#/zh-CN/intro github地址:https://github.com/youz ...
- yii2 部分很实用的代码
检查执行的sql $query->createCommand()->getRawSql() 写日志 // 记录日志 \Yii::error('生成失败.' . $index, $t ...
- 【C语言程序】输出前50个素数
#include <stdio.h> #include <stdlib.h> int main(void) { ; ; ){ ; ;i<x;i++){ ...
- Java反射通过getter和setter方法实现类的拷贝
private User copyFieldValues(User userData, User user) { Field[] fields = user.getClass().getDeclare ...
- python之面向对象深入探测
一 __doc__ 表示类的描述信息 #!/usr/bin/env python # -*- coding: utf-8 -*- class C: """ 这是个大美女 ...
- 配置Spark
参考<深入理解Spark:核心思想与源码分析> Spark使用Scala进行编写,而Scala又是基于JVM运行,所以需要先安装JDK,这个不再赘述. 1.安装Scala 安装获取Scal ...
- java基础 第六章课后习题
1.说明循环结构中break语句和continue语句的区别. 在循环结构中 break语句 是结束程序运行. continue语句是结束本句程序 不是结束程序. 2.使用for循环结构实现,从键盘 ...
- hadoop三个配置文件的参数含义说明
1 获取默认配置 配置hadoop,主要是配置core-site.xml,hdfs-site.xml,mapred-site.xml三个配置文件,默认下来,这些配置文件都是空的,所以很难知 ...
- 14 - How to check replication status
The people using PostgreSQL and the Streaming Replication feature seem to ask many of the same quest ...
- type显示的是访问类型,是较为重要的一个指标,结果值从好到坏依次是: system > const > eq_ref > ref > fulltext > ref_or_null > index_merge > unique_subquery > index_subquery > range > index > ALL ,一般来说,得保证查询至少达到range级别,最好能达到ref。 作者:高
MySQL EXPLAIN详解 - 简书 https://www.jianshu.com/p/ea3fc71fdc45 type显示的是访问类型,是较为重要的一个指标,结果值从好到坏依次是: syst ...