Codeforces Round #426 (Div. 2) C. The Meaningless Game(简单数学)
来源:互联网 发布:mysql crea 编辑:程序博客网 时间:2024/06/05 15:46
传送门
题意:
一个游戏,一开始给两个1,每一轮其中任意一个乘以k,另一个乘以 k^2,最后得到两个数 a,b;若a,b是满足游戏条件的数则输出Yes,否则输出 No
思路:
1、a * b 开立方 可以得到 每一次操作的k的乘积 c
2、aa = a / c 得到 a 乘了 两次的 k 的乘积,显然 b 只乘了一次 aa
bb = b / c 得到 b 乘了 两次的 k 的乘积,显然 a 只乘了一次 bb
3、则 应有 aa * aa * bb == a 与 bb * bb * aa == b
#include <bits/stdc++.h>using namespace std;#include <bits/stdc++.h>using namespace std;#define LL long long#define N 1000005#define M 105#define INF 0x3f3f3f3f#define mod 1000000007#define eps 1e-8int main(){ int n; scanf("%d",&n); while(n--){ LL a,b; scanf("%lld%lld",&a,&b); LL c = cbrt(a*b); LL aa = a / c; LL bb = b / c; if(aa * aa * bb == a && bb * bb * aa == b){ puts("Yes"); }else puts("No"); } return 0;}
阅读全文
1 0
- Codeforces Round #426 (Div. 2) C. The Meaningless Game(简单数学)
- Codeforces Round #426 (Div. 2) C. The Meaningless Game C. The Meaningless Game
- (Codeforces Round #426 (Div. 2)) C.The Meaningless Game
- Codeforces Round #426 (Div. 2) C. The Meaningless Game
- Codeforces Round #426 (Div. 2)-C. The Meaningless Game
- Codeforces Round #426 (Div. 2) C The Meaningless Game
- Codeforces Round #426 (Div. 2) C. The Meaningless Game
- Codeforces Round #426 (Div. 2) C. The Meaningless Game
- Codeforces Round #426 (Div. 2) C The Meaningless Game
- Codeforces Round #426 (Div. 2) C:The Meaningless Game The Meaningless Game
- C. The Meaningless Game(Codeforces Round #426 (Div. 2) C)
- (数学或二分)Codeforces Round #426 C. The Meaningless Game
- Codeforces Round #426 (Div. 2) C: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【数学题】【水题】
- Codeforces Round #426 (Div. 2)The Meaningless Game(思维+二分)
- Codeforces Round #426 (Div. 2) C. The Meaningless Game 思维 D. The Bakery dp
- 六大设计原则
- 深入解析windows XP/2003:内核模式和用户模式
- 应用层vc实现三种文件监视方法 下面介绍三种非驱动实现文件监视的方法。 =============================================================
- 【Google】25匹马的角逐
- DDL和DML的定义和区别
- Codeforces Round #426 (Div. 2) C. The Meaningless Game(简单数学)
- APP 项目开发前的准备工作
- dfs hdu1241 Oil Deposits
- HDU 5131 Song Jiang's rank list(暴力)
- iOS Push Notifications第二项老是红色
- 如何找出数组中唯一的重复元素
- 七年之痒
- javasript 把字符串转换为对象的2种方法
- .net新手爬虫教学,简单易懂。