The Meaningless Game 【codeforces】【思维】
来源:互联网 发布:火凤凰云计算拖欠工资 编辑:程序博客网 时间:2024/06/05 02:33
题意:两个人玩一个游戏,给出自然数k,赢得乘k^2,输的乘k,然后给出两个数,问能否得到这两个数。
题解:对于每次操作一个乘k^2,一个乘k;二者合一块就是乘k^3。 所以对于给出的两个数,如果他们的乘积是某个数的三次方,且能整除这两个数,说明这两个数是正确的;
#include<cstdio>#include<algorithm>#include<cmath>using namespace std;typedef long long ll;int main(){int n;while(~scanf("%d",&n)){while(n--){ll a,b;scanf("%lld%lld",&a,&b);ll c=a*b;ll x=round(pow((double)c,1.0/3));if((x*x*x==c)&&a%x==0&&b%x==0) printf("Yes\n");else printf("No\n");}}return 0;}
阅读全文
0 0
- The Meaningless Game 【codeforces】【思维】
- Codeforces 834C The Meaningless Game【思维】
- codeforces The Meaningless Game 数学思维
- Codeforces Round #426 (Div. 2)The Meaningless Game(思维+二分)
- Codeforces Round #426 (Div. 2)The Meaningless Game(思维+二分)
- Codeforces Round #426 (Div. 2)The Meaningless Game(思维+二分)
- The Meaningless Game(思维题)
- Codeforces Round #426 (Div. 2) C. The Meaningless Game 思维 D. The Bakery dp
- Codeforces Round #426 (Div. 2) C:The Meaningless Game(思维)
- 【Codeforces】834C. The Meaningless Game
- Codeforces Round 833A-The Meaningless Game
- Codeforces 833A-The Meaningless Game
- 【CodeForces】426Div2 C The Meaningless Game
- codeforces 834C (The Meaningless Game)
- CodeForces #426 div2 C The Meaningless Game
- codeforces 834 C The Meaningless Game
- codeforces 834 C The Meaningless Game
- CodeForces 834C The Meaningless Game
- HDU
- MVP
- SpringMVC 文件上传配置,多文件上传,使用的MultipartFile
- python2与python3在pycharm中的切换
- Java阶段学习概括
- The Meaningless Game 【codeforces】【思维】
- JSP内建对象介绍
- C语言基础学习(2)
- 金融初学者建议
- 表格全选与全不选,选中删除
- Pandas日期数据处理:如何按日期筛选、显示及统计数据
- WCF读取数据库中的数据传输至WPF显示
- ipython notebook 下包含python2, python3两个kernel
- Linux(C/C++)下的文件操作open、fopen与freopen