我是靠谱客的博主 香蕉睫毛,这篇文章主要介绍Codeforces Round #426 (Div. 2) C The Meaningless Game,现在分享给大家,希望可以做个参考。

题意
检测两个数是否可以表示成a=k1^2*k2+k3*k4^2 b = k1*k2^2*k3^2*k4
即一个是平方,一个就是原本的.
我推了一些简单的必要条件,进行堆叠,勉强过了,但是具体还不知道,留待后考吧.

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* 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_back typedef 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::endl const 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; }

最后

以上就是香蕉睫毛最近收集整理的关于Codeforces Round #426 (Div. 2) C The Meaningless Game的全部内容,更多相关Codeforces内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(85)

评论列表共有 0 条评论

立即
投稿
返回
顶部