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. java代码(2)---Java8 Stream

    stream Java8新特性Stream流,那Stream表达式到底是什么呢,为什么可以使你的代码更加整洁而且对集合的操作效率也会大大提高? 一.概述 1.什么是Stream Stream是一种可供 ...

  2. 连接mongoodb并且向数据库添加信息

    连接mongoodb 首先安装mongoose 配置URL 连接Mongoodb数据库 控制台输入指令运行该js文件 像这样就连接成功了 向Mongodb数据库增加信息,首先需要写入表格信息 接着解构 ...

  3. 哪些年,我们玩过的Git

    作者:玩世不恭的Coder公众号:玩世不恭的Coder时间:2020-06-05说明:本文为原创文章,未经允许不可转载,转载前请联系作者 哪些年,我们玩过的Git 前言一.前期工作常用基本概念的理解G ...

  4. .Net Core实战之基于角色的访问控制的设计

    前言 上个月,我写了两篇微服务的文章:<.Net微服务实战之技术架构分层篇>与<.Net微服务实战之技术选型篇>,微服务系列原有三篇,当我憋第三篇的内容时候一直没有灵感,因此先 ...

  5. intput子系统

    1.按键驱动程序的第一个版本:day07/04      //内核模块的基本要求   init.h module.h LICENSE      struct cdev btn_cdev;      b ...

  6. java 中有几种类型的流?

    字节流,字符流. 字节流继承于 InputStream \ OutputStream, 字符流继承于 InputStreamReader \ OutputStreamWriter. 在 java.io ...

  7. Git Commit 提交规范

    写好 Commit message 好处多多: 1.统一团队Git commit 日志风格 2.方便日后 Reviewing Code 3.帮助我们写好 Changelog 4.能很好的提升项目整体质 ...

  8. eclipse Luna 安装SVN插件

    Help--->Install New Soft ----> 输入 “Luna - http://download.eclipse.org/releases/luna” 这里显示都是 lu ...

  9. ucore系统 eclipse-cdt实验环境准备

    官网下载eclipse eclipse-cpp-luna-SR2-linux-gtk-x86_64.tar.gz省略安装jdk 等配置解压安装即可导入实验的项目 点击完成即可完成导入 开始配置qemu ...

  10. idea出现 淇℃伅 乱码

    问题:我是idea出现 淇℃伅 乱码, 解决:修改 tomcat 下的 logging.properties这个文件 为 GBK 就好了. 参考:https://blog.csdn.net/weixi ...