Codeforces Round #426 (Div. 2) C The Meaningless Game
来源:互联网 发布:淘宝卖aj的正品店 编辑:程序博客网 时间:2024/06/07 10:30
题意
检测两个数是否可以表示成a=k1^2*k2+k3*k4^2 b = k1*k2^2*k3^2*k4
即一个是平方,一个就是原本的.
我推了一些简单的必要条件,进行堆叠,勉强过了,但是具体还不知道,留待后考吧.
/* Farewell. */#include <iostream>#include <vector>#include <cstdio>#include <string.h>#include <algorithm>#include <queue>#include <map>#include <string>#include <cmath>#include <bitset>#include <iomanip>#include <set>using namespace std;#define FFF freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);#define gcd __gcd#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define MP make_pair#define MT make_tuple#define PB push_backtypedef long long LL;typedef unsigned long long ULL;typedef pair<int,int > pii;typedef pair<LL,LL> pll;typedef pair<double,double > pdd;typedef pair<double,int > pdi;const int INF = 0x7fffffff;const LL INFF = 0x7f7f7f7fffffffff;const int MOD = 1e9+7;#define debug(x) std::cerr << #x << " = " << (x) << std::endlconst int MAXM = 5e3+17;const int MAXN = 1e6+17;LL cub[MAXN];int main(int argc, char const *argv[]){ #ifdef GoodbyeMonkeyKing freopen("in.txt","r",stdin);freopen("out.txt","w",stdout); #endif for (int i = 0; i < MAXN; ++i) { cub[i] = 1LL*(i+1)*(i+1)*(i+1); } int t; cin>>t; while(t--) { LL a,b; scanf("%lld%lld",&a,&b); LL temp = a*b; //debug(temp); //debug(cub[lower_bound(cub, cub+MAXN, temp)-cub]); if(cub[lower_bound(cub, cub+MAXN, temp)-cub]!=temp) { puts("NO"); continue; } LL oa = a,ob = b; if(a==b) { if(a==1) { puts("YES"); continue; } if(cub[lower_bound(cub, cub+1002, a)-cub]==a) puts("YES"); else puts("NO"); continue; } LL gd = gcd(a,b); a/=gd; b/=gd; if(gd%(a*b)==0) { puts("YES"); } else puts("NO"); } return 0;}
阅读全文
0 0
- 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
- 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
- Codeforces Round #426 (Div. 2) B.The Festive Evening+C.The Meaningless Game
- C. The Meaningless Game(Codeforces Round #426 (Div. 2) C)
- Codeforces Round #426 (Div. 2) C. The Meaningless Game & A, B题代码及错误总结
- Codeforces Round #426 (Div. 2) A B C The Meaningless Game
- c++11多线程编程(一):创建线程的三种方法
- spring cloud Ribbon 2 (客户端负载均衡)
- 如何实现UML图的逻辑(C++)
- 51Nod-1428-活动安排问题
- read/write函数实现文件的copy
- Codeforces Round #426 (Div. 2) C The Meaningless Game
- C++ 设计模式-》中介者模式(Mediator)
- NOI模拟(10.29)T2 棋盘
- nodejs req参数应用
- 零基础学图形学(1) 序言——各级标题
- xml从入门到精通之schema文件
- 有一个排好序的数列,数列中只有一个数只出现1次,其余每个数均出现了两次,设计出一个算法,找出那个只出现了一次的数
- 初始化EHcache CacheManager时报java.net.UnknownHostException
- QT中eventFilter的使用方法