C. The Meaningless Game

题目链接

题意

给你两个数,开始都为1,然后每轮可以任选一个k,一边可以乘以\(k\),另一边乘以\(k^2\),然后问你最终是否可以得到所给的两个数a,b;

思路

\(a×b = t^3\),二分是否存在\(t\),如果不存在肯定不可以,如果存在,那么要保证a中有t中所有的因子,b中也是,那么就是$ amodt==0 and bmodt == 0\(,因为\)t = k1k2...kn\(,那么\)a\(中要么是\)k1^2\(要么是\)k1\(,同理\)b$

代码

#include<bits/stdc++.h>
#define N 100005
using namespace std;
typedef long long LL;
LL gcd(LL n,LL m);
int main(void)
{
int T;
scanf("%d",&T);
while(T--)
{
LL a,b;
scanf("%lld %lld",&a,&b);
LL c = a*b;
LL l = 0,r = 1000000;
LL id;
while(l <= r)
{
LL mid = (l+r)/(LL)2;
if(mid*mid*mid <= a*b)
{
l = mid + 1;
id = mid;
}
else r = mid - 1;
}
if(id*id*id != a*b)
{
printf("No\n");
}
else
{ //aprintf("%d\n",id);
if(!(a%id)&&!(b%id))
printf("Yes\n");
else printf("No\n");
}
}
return 0;
}
LL gcd(LL n,LL m)
{
if(m == 0)
return n;
else return gcd(m,n%m);
}

C. The Meaningless Game的更多相关文章

  1. Cassandra - Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless

    In cassandra 2.1.4, if you run "nodetool status" without any keyspace specified, you will ...

  2. C. Meaningless Operations Codeforces Global Round 1 异或与运算,思维题

    C. Meaningless Operations time limit per test 1 second memory limit per test 256 megabytes input sta ...

  3. Codeforces 833A The Meaningless Game - 数论 - 牛顿迭代法 - 二分法

    Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting. T ...

  4. Codeforces Round #426 (Div. 2) C. The Meaningless Game

    C. The Meaningless Game 题意: 两个人刚刚开始游戏的时候的分数, 都是一分, 然后随机一个人的分数扩大k倍,另一个扩大k的平方倍, 问给你一组最后得分,问能不能通过游戏得到这样 ...

  5. Codeforces 834C - The Meaningless Game

    834C - The Meaningless Game 数学. 思路1:判断a•b能不能化成v3且a%v==0且b%v==0.v可以直接用pow求(或者用cbrt),也可以二分求:还可以用map映射预 ...

  6. A. The Meaningless Game(数学)

    A. The Meaningless Game time limit per test:1 second memory limit per test:256 megabytes input:stand ...

  7. Codeforces Round #426 The Meaningless Game

    题目网址:http://codeforces.com/contest/834/problem/C 题目: C. The Meaningless Game Slastyona and her loyal ...

  8. CodeForces 834C - The Meaningless Game | Codeforces Round #426 (Div. 2)

    /* CodeForces 834C - The Meaningless Game [ 分析,数学 ] | Codeforces Round #426 (Div. 2) 题意: 一对数字 a,b 能不 ...

  9. MDK中问题:warning : type qualifier is meaningless on cast type return 的解决

    在MDK编译代码时,有时会出现这样的警告, warning : type qualifier is meaningless on cast type return 在MDK中,作如下设置: 即添加 : ...

  10. The meaningless Game

    题目 Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting ...

随机推荐

  1. bluetooth sig bluetooth asia-深圳之行

    18年5月30日深圳参见蓝牙展会 主要了解下面 使用蓝牙和区块链构建室内导航定位系统和去中心化的MESH网络 -- 核心是通过iBeacon 来广播数据,典型用例是手机对手机的使用蓝牙进行交互,业界称 ...

  2. PC端申请表

    公司项目需求中要做用html做一个PDF申请表的样式出来.有点意思,贴上来大家看看. 先上效果图: 附上源代码: HTML:<div id="form"> <h2 ...

  3. IT四大名著

    标题耸人听闻,sorry. CPU.操作系统.编译器和数据库我都不会.我英语也不行,但我认识所有的字母.:-) 万一有人感兴趣呢?https://sqlite.org/doclist.htmlThe ...

  4. netty系列之:手持framecodec神器,创建多路复用http2客户端

    目录 简介 配置SslContext 客户端的handler 使用Http2FrameCodec Http2MultiplexHandler和Http2MultiplexCodec 使用子channe ...

  5. java-阿里邮件推送服务开发 -- 发送邮箱验证码

    参考文档: 如何在 DNS 服务器上配置域名:https://help.aliyun.com/knowledge_detail/39397.html?spm=5176.2020520150.102.d ...

  6. lucene中创建索引库

    package com.hope.lucene;import org.apache.commons.io.FileUtils;import org.apache.lucene.document.Doc ...

  7. vue cli3.0 首次加载优化

    项目经理要求做首页加载优化,打包后从十几兆优化到两兆多,记下来怕下次忘记 运行report脚本 可看到都加载了那些内容,在从dist文件中index.html 查看首次加载都加载了那些东西,如下图:然 ...

  8. 『与善仁』Appium基础 — 22、获取元素信息的操作(一)

    目录 1.获取元素文本内容 (1)text()方法 (2)get_attribute()方法 (3)综合练习 2.获取元素在屏幕上的坐标 1.获取元素文本内容 (1)text()方法 业务场景: 进入 ...

  9. CPU的负载

    目录 一.简介 二.合理的负载 一.简介 使用top或者uptime命令可以看到cpu平均负载,1,5,15分钟 平均负载包括以下几个部分: 正在运行的进程.正在使用cpu做计算的进程,ps看到R 也 ...

  10. 项目的基本概念(Project)

    <Project2016 企业项目管理实践>张会斌 董方好 编著 我一看到这个标题就头疼,好吧,又是概念,好在我不要参加相关的考试,否则文字连同标点符号都得背%¥#%#~ 张同学说,项目& ...