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. mvc中常见的属性验证

    客户端验证逻辑会对用户向表单输入的数据给出一个即时反馈.而之所以需要服务器端验证,是因为来自网络的信息都是不能被信任的. 当在ASP.NET MVC设计模式上下文中谈论验证时,主要关注的是验证模型的值 ...

  2. 云原生时代,为什么基础设施即代码(IaC)是开发者体验的核心?

    作者 | 林俊(万念) 来源 |尔达 Erda 公众号 从一个小故事开始 你是一个高级开发工程师. 某天,你自信地写好了自动煮咖啡功能的代码,并在本地调试通过.代码合并入主干分支后,你准备把服务发布到 ...

  3. three.js很好玩

    能用鼠标拉着转. https://files.cnblogs.com/files/blogs/714801/%E7%A9%BA%E9%97%B4%E5%87%A0%E4%BD%95.7z var po ...

  4. accommodate, accompany

    accommodate 词源: to make fit, suitable; 近/反义词: adapt, adjust, lodge; disoblige, incommode, misfit Lod ...

  5. 实时数仓(二):DWD层-数据处理

    目录 实时数仓(二):DWD层-数据处理 1.数据源 2.用户行为日志 2.1开发环境搭建 1)包结构 2)pom.xml 3)MykafkaUtil.java 4)log4j.properties ...

  6. 【Reverse】每日必逆0x02

    BUU SimpleRev 附件 https://files.buuoj.cn/files/7458c5c0ce999ac491df13cf7a7ed9f1/SimpleRev 题解 查壳 拖入iad ...

  7. ORACLE中dual用法详解

    基本上oracle引入dual为的就是符合语法1. 我们先从名称来说,dual不是缩写词,本身就是完整的单词.dual名词意思是对数,做形容词时是指二重的,二元的.2. Oracle中的dual表是一 ...

  8. mybatis-plus解析

    mybatis-plus当用lambda时bean属性不要以is/get/set开头,解析根据字段而不是get/set方法映射

  9. winxp 关闭445端口

    关闭445端口的方法方法很多,但是我比较推荐以下这种方法: 修改注册表,添加一个键值 Hive: HKEY_LOCAL_MACHINE Key: System\Controlset\Services\ ...

  10. 基于DataX将数据从Sqlserver同步到Oracle

    DataX是阿里云推出的一款开源的ETL工具,通过配置json文件实现不同数据库之间的数据同步.先有需求是从Sqlserver同步数据到Oracle,网上关于DataX的介绍很多. 框架设计 Data ...