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实现第四届蓝桥杯核桃的数量

    核桃的数量 题目描述 小张是软件项目经理,他带领3个开发组.工期紧,今天都在加班呢.为鼓舞士气,小张打算给每个组发一袋核桃(据传言能补脑).他的要求是: 各组的核桃数量必须相同 各组内必须能平分核桃( ...

  2. 实战记录之SQL server报错手工注入

    前言 最近测试了一个站点,这个站点挺有意思,发现没有关闭错误提示,初步猜测是SQL server数据库,后来验证确实是.在这里记录一下实战过程,并详细讲解一下用到的知识点. SQL server报错注 ...

  3. 认识OSI七层模型

    概述: OSI全名(Open System Interconnect),是指定的开放系统互连参考模型,为开放式互连信息系统提供了一种功能结构的框架.层次:从低到高的层级:物理层.数据链路层.网络层.传 ...

  4. 多态的C语言实现版本

    #ifndef _51_2_H #define _51_2_H typedef void Demo; typedef void Derived; Demo* Demo_create(int i,int ...

  5. ubuntu12.04可用源

    最近试了不少源,都无法用.这一份是目前可以正常使用的 #deb cdrom:[Ubuntu 12.04.5 LTS _Precise Pangolin_ - Release amd64 (201408 ...

  6. 关于Attach *.mdf数据库联想到的备份

    要求: 将SQL2008R2的*.mdf ( 当时内部版本不详,此时无挂接在MSSQL服务器上的数据库,只有*.mdf文件 ) --->>> SQL2008R2中,附加到现有SQL2 ...

  7. 动作函数-web_submit_data

    web_submit_data("login.pl", "Action=http://127.0.0.1:1080/WebTours/login.pl", &q ...

  8. dB是乘以10还是乘以20

    dB即分贝(decibel),经常用来表示信号的大小.然而,今天在学习计算机网络的时候发现分贝的公式有两种:10lg(X) 或者 20lg(X) 很迷惑所以查找资料.得到的结果是dB在表示功率的时候用 ...

  9. MongoDB——基本使用及集群搭建

    文章目录 什么是MongoDb? 基本概念 与关系型数据库的比较 Mongo的高效性 文件存储 基本使用 启动/连接服务 基础操作命令 高可用集群搭建 概念 环境准备 实践 应用场景 总结 什么是Mo ...

  10. MFC时间简单比较方法

    MFC//时间简单比较方法 void CMFCsaveListTofileDlg::OnBnClickedButton6()//时间简单比较方法 { // TODO: 在此添加控件通知处理程序代码 C ...