Codeforces 833A The Meaningless Game

http://codeforces.com/problemset/problem/833/A

a*b开三方,检查是否是整数且a,b能整除它就好。

#include<cstdio>
#include<cmath>
using namespace std;
#define ll long long
int T;
ll a,b;
int main(){
    scanf("%d",&T);
    while(T--){
        scanf("%lld%lld",&a,&b);
        ll c=a*b;
        c=round(pow((double)c,1.0/3));
        if(c*c*c!=a*b||a%c||b%c) printf("No\n");
        else printf("Yes\n");
    }
    return 0;
}
时间: 2024-10-11 08:49:47

Codeforces 833A The Meaningless Game的相关文章

Codeforces 833A The Meaningless Game - 数论 - 牛顿迭代法 - 二分法

Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting. The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it fast

Codeforces Round #426 (Div. 1) (ABCDE)

1. 833A The Meaningless Game 大意: 初始分数为$1$, 每轮选一个$k$, 赢的人乘$k^2$, 输的人乘$k$, 给定最终分数, 求判断是否成立. 判断一下$a\cdot b$是否是立方数, 以及能否被那个立方的因子整除即可. cbrt竟然有误差, 特判了一下, 好坑 #include <iostream> #include <sstream> #include <algorithm> #include <cstdio> #i

Codeforces Round #426 (Div. 2) C. The Meaningless Game (二分 or pow函数)

Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting. The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it fast

Codeforces Round #426 (Div. 1) A.The Meaningless Game (二分+数学)

题目链接: http://codeforces.com/problemset/problem/833/A 题意: 给你 \(a\) 和 \(b\),两个人初始化为 \(1\).两个人其中一方乘以 \(k^2\),另一方就乘以 \(k\).问你能不能达到 \((a,b)\) 这个最终状态. 题解: 设 \(X\), \(P\) 表示两个乘积的集合. 那么,显然: \(S^{2}*P=a\) ------ 1 \(S*P^{2}=b\) ------ 2 所以:\(a*b = S^{3}*P^3\)

C. Meaningless Operations Codeforces Global Round 1 异或与运算,思维题

C. Meaningless Operations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question.

Codeforces Round #426 (Div. 2)C. The Meaningless Game

题意:AB两个人,每一轮,其中一人选择一个数字K,那么A就变成A*k*k,B就变成B*K,给出结果,问是否可能 思路:不管多少轮,A*B结果都是某个数的立方,二分 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int N=1e5+10,M=1e6+10,inf=1e9+7,MOD=1e9+7; 5 const ll INF=1e18+10,mod=1e9+7; 6 7 8 int

【Codeforces Global Round 1 C】Meaningless Operations

[链接] 我是链接,点我呀:) [题意] 给你一个a 让你从1..a-1的范围中选择一个b 使得gcd(a^b,a&b)的值最大 [题解] 显然如果a的二进制中有0的话. 那么我们就让选择的b的二进制中对应的位置为1 剩下全为0就好 这样a的二进制全都变成1之后就是答案了(gcd的右边是0). 但是如果a的二进制里面全是1的话. 就没办法这么构造了 这里有两种情况. ①.1的个数是偶数 那么就101010这样构造 另外一个数就是010101 答案就是010101转换成十进制 ②.1的个数是奇数

Codeforces Round #426 (Div. 2)A B C题+赛后小结

最近比赛有点多,可是好像每场比赛都是被虐,单纯磨砺心态的作用.最近讲的内容也有点多,即便是点到为止很浅显的版块,刷了专题之后的状态还是~"咦,能做,可是并没有把握能A啊".每场网络赛,我似乎都没用上新学的东西,能用上新学东西的题我A不了...5555555555555555 这场CF,讲真,打的心态爆炸,首先A题无限WA,赛后看下WA的那组数据是输入有一个999999999的样例,死骗子,说好的数据是1e9呢,哪能有数据是1e10-1,于是用long long,一下子Accept接收不

Codeforces Global Round 1 (A-E题解)

Codeforces Global Round 1 题目链接:https://codeforces.com/contest/1110 A. Parity 题意: 给出{ak},b,k,判断a1*b^(k-1)+a2*b^(k-2)+...+ak*b^0的奇偶性. 题解: 暴力求模2意义下的值就好了. 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5+5; int