Code Forces 833 A The Meaningless Game

题目大意

有两个人玩游戏,每轮给出一个自然数k,赢得人乘k^2,输得人乘k,给出最后两个人的分数,问两个人能否达到这个分数

不得不吐槽一下那么长的英文题面翻译完只有一句话……

solution

也很好想叭

乘积开立方判断是否为两个数的因数

如果是的话,显然不成立

否则输出Yes即可

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std; inline int read(){
int x = 0, w = 1;
char ch = getchar();
for(; ch > '9' || ch < '0'; ch = getchar()) if(ch == '-') w = -1;
for(; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
return x * w;
} signed main(){
int n = read();
while(n--){
int a = read(), b = read();
int tmp = a * b;
int awsl = pow(tmp, (1.0 / 3)) + 0.5;
// int awsl = cbrt((double)a*(double)b);//在网上找到了这个开三次方的函数,啧啧,不过好像不太会用……
if(awsl * awsl * awsl != tmp || a % awsl || b % awsl) cout << "No" << endl;
else cout << "Yes" << endl;
}
return 0;
}

Code Forces 833 A The Meaningless Game(思维,数学)的更多相关文章

  1. 思维题--code forces round# 551 div.2

    思维题--code forces round# 551 div.2 题目 D. Serval and Rooted Tree time limit per test 2 seconds memory ...

  2. Code Forces 796C Bank Hacking(贪心)

    Code Forces 796C Bank Hacking 题目大意 给一棵树,有\(n\)个点,\(n-1\)条边,现在让你决策出一个点作为起点,去掉这个点,然后这个点连接的所有点权值+=1,然后再 ...

  3. [Codeforces 1178D]Prime Graph (思维+数学)

    Codeforces 1178D (思维+数学) 题面 给出正整数n(不一定是质数),构造一个边数为质数的无向连通图(无自环重边),且图的每个节点的度数为质数 分析 我们先构造一个环,每个点的度数都是 ...

  4. Code Forces 543A Writing Code

    题目描述 Programmers working on a large project have just received a task to write exactly mm lines of c ...

  5. code forces 1051 d

    看的这个题解:http://www.cnblogs.com/tobyw/p/9685639.html 写的比较清楚. 矩阵类型的计数题 比赛时感觉就像是个dp,然后就跳过了. 现在看着题解写一下,感觉 ...

  6. The Meaningless Game 思维题

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

  7. code forces 383 Arpa's loud Owf and Mehrdad's evil plan(有向图最小环)

    Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megab ...

  8. code forces 382 D Taxes(数论--哥德巴赫猜想)

    Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output ...

  9. code forces Watermelon

    /* * Watermelon.cpp * * Created on: 2013-10-8 * Author: wangzhu */ /** * 若n是偶数,且大于2,则输出YES, * 否则输出NO ...

随机推荐

  1. Shell中傻傻分不清楚的TOP3

    Shell中傻傻分不清楚的TOP3 发布文章 近来小姐姐又犯憨憨错误,问组内小伙伴export命令不会持久化环境变量吗?反正我是问出口了..然后小伙伴就甩给了我一个<The Linux Comm ...

  2. 04-Python基础3

    本节内容 迭代器&生成器 装饰器 Json & pickle 数据序列化 软件目录结构规范 作业:ATM项目开发 1.列表生成式,迭代器&生成器 列表生成式 孩子,我现在有个需 ...

  3. org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate——解决方案汇总

    近期将自己本地的 maven 仓库进行了迁移,idea 的版本也升级到了IntelliJ IDEA 2019.3.3 x64,但是遇到了 Plugins 报红的情况,尝试很多方法,终于解决,现在做一下 ...

  4. 2.Go--hello world

    编写一个hello world package main import ( "fmt" "time" ) func main(){ fmt.Println(&q ...

  5. Source Insight 中的 Auto Indenting

    编码过程中,希望输入花括号时能自动对齐,Source Insigth 应如何设置? 先来看一下Source Insight 中的帮助. “ Auto Indenting The auto-indent ...

  6. Floating-Point Hazard【求导公式】

    Floating-Point Hazard 题目链接(点击) 题目描述 Given the value of low, high you will have to find the value of ...

  7. postman切换环境

    原文链接:https://www.cnblogs.com/nicole-zhang/p/11498384.html 通常会有多个测试环境,针对同一个接口来说,可能只是域名有变化,此时可以添加postm ...

  8. python基础内容整理(一)

    基本数据类型 字符串 String 字符串是不可变类型 字符串的分割: s.split(sep)以给定的sep为分隔符对s进行分割. In [4]: s = "hello world&quo ...

  9. 认证授权方案之JwtBearer认证

    1.前言 回顾:认证方案之初步认识JWT 在现代Web应用程序中,即分为前端与后端两大部分.当前前后端的趋势日益剧增,前端设备(手机.平板.电脑.及其他设备)层出不穷.因此,为了方便满足前端设备与后端 ...

  10. lw_oopc(c语言实现面向过程宏文件)解析

    一:计算结构体成员变量偏移量宏 #ifdef LW_OOPC_USE_USER_DEFINED_OFFSETOF // 有些环境可能不支持,不过,这种情形极少出现 #define LW_OOPC_OF ...