【Codeforces Round #426 (Div. 2) C】The Meaningless Game
The Codeforces div round Game
2023-09-14 09:03:49 时间
有一个两人游戏游戏;
游戏包括多轮,每一轮都有一个数字k,赢的人把自己的分数乘上
给你两个数字a,b;
问你第一个人的分数为a,第二个人的分数为b可不可能;
考虑最后的合法结果;
必然是这种形式
因为不是第一个人得k^2就是第二个人得k^2
如
k1^2*k2*k3^2
k1*k2^2*k3
上面S=k1*k3,P=k2
又有
则设
然后带回最上面那个式子
则,需要判断a*b是否为立方数,然后判断x能否整除a,能否整除b即可;
都行则有解
6
没能用合适的数学方法看待问题.
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,x,y,a;
main(){
ios::sync_with_stdio(0);
scanf("%lld",&n);
for (int i = 1;i <= n;i++){
scanf("%lld%lld",&x,&y);
a = x*y;
int l = 1,r = 1e6,ans =-1;
while (l <= r){
int m = (l+r)>>1;
int temp = m*m*m;
if (temp <= a){
if (temp==a)ans = m;
l = m+1;
}else
r = m-1;
}
if (ans==-1 || x%ans || y % ans)
puts("NO");
else
puts("YES");
}
return 0;
}
相关文章
- Hack The Box,一款有意思的渗透测试平台
- 【错误记录】Android Studio 创建报错 ( The length of the module location exceeds the limit of 100 characters. )
- 【Vue-Spring跨域Bug已解决】has been blocked by CORS policy: The value of the······
- ORA-25014: cannot change the value of a PARENT reference variable ORACLE 报错 故障修复 远程处理
- ORA-30158: The OCIFileWrite causes the file to exceed the maximum allowed size ORACLE 报错 故障修复 远程处理
- ORA-30963: The indexed column is not of XMLType. ORACLE 报错 故障修复 远程处理
- ORA-31692: The following SQL statement failed trying to insert a row into the Master table: string ORACLE 报错 故障修复 远程处理
- ORA-38475: The attribute set and the associated ADT are out of sync. ORACLE 报错 故障修复 远程处理
- ORA-40120: invalid weight value in the weights table ORACLE 报错 故障修复 远程处理
- ORA-48414: The string in the execution option exceeds maximum length [string] ORACLE 报错 故障修复 远程处理
- ORA-48439: The input path name exceeds the maximum length [string] ORACLE 报错 故障修复 远程处理
- ORA-48461: “describe” failed due to the following errors ORACLE 报错 故障修复 远程处理
- ORA-48486: The file [string] exceeds the maximum length [string] ORACLE 报错 故障修复 远程处理
- ORA-01610: recovery using the BACKUP CONTROLFILE option must be done ORACLE 报错 故障修复 远程处理
- ORA-13632: The user cancelled the current operation. ORACLE 报错 故障修复 远程处理
- Oracle 00103: Redefining the Database Frontier(oracle00103)
- MySQL 5.7.17:The Latest Upgrade of the Database System(mysql5.7.17)
- 修复 Ubuntu 中 “E: The package cache file is corrupted, it has the wrong hash”
- Yumming up Redis: Taste the Benefits(yumredis)
- Unveiling the Magic of TTY in Linux(linux中的tty)
- Exploring the Dynamic Duo: The Power of Solr MongoDB Integration(solrmongodb)
- Exploring the Power of MongoDB: The Definitive Guide to Upgrading Arrays(mongodb更新数组)
- Connecting to MySQL: The Essential Guide to Database Connectivity(mysql数据库连接)
- Understanding the Use of FloatingPoint Data Type in MySQL(mysql浮点型)
- Exploring the Power of as86 Linux: The Ultimate Guide for Beginners!(as86linux)
- Exploring the Features and Benefits of SQL Server 7.0: Maximizing Your Data Management Capabilities(sqlserver7.0)
- Oracle介绍The函数的应用(oracle the函数)