当前位置:网站首页>CodeForces-834C
CodeForces-834C
2022-08-10 13:19:00 【51CTO】
Slastyona and her loyal dog Pushok are playing a meaningless game
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 faster than the other wins the round. After that, the winner's score is multiplied by k2, and the loser's score is multiplied by k. In the beginning of the game, both Slastyona and Pushok have scores equal to one.
Unfortunately, Slastyona had lost her notepad where the history of all n games
Input
In the first string, the number of games n (1 ≤ n ≤ 350000)
Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109)
Output
For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise.
You can output each letter in arbitrary case (upper or lower).
Example
Input
Output
题目大概:
Two people talking numbers,Whoever is bigger wins,The winning team's score is multiplied by the square of the larger number,Multiply the lost fraction by the larger number,Know the two scores first,Ask if the match rating is correct.(Games can have multiple rounds)
思路:
When a round,Multiply two fractions to the third power of a large number,when multiple rounds,也成立,It is the cube of the product of multiple rounds of large numbers.Use binary to find the final value,Check if the value is correct,并输出结果.
代码:
边栏推荐
猜你喜欢
随机推荐
Shell:数组
Basic knowledge of switches
教育Codeforces轮41(额定Div。2)大肠Tufurama
shell:正则表达式及三剑客grep命令
odps sql 不支持 unsupported feature CREATE TEMPORARY
22家!北京昌平区通报存在食品安全问题餐饮服务企业
娄底干细胞制备实验室建设须知要求
Merge similar items in LeetCode simple questions
bgp双平面实验 路由策略控制流量
Redis上云迁移实践
Efficient and Robust 2D-to-BEV Representation Learning via Geometry-guided Kernel Transformer 论文笔记
Codeforces Round #276 (Div. 1) B. Maximum Value
22!Beijing Changping District notified catering service enterprises with food safety problems
rpn:def concat_box_prediction_layers
Redis 定长队列的探索和实践
2022年8月中国数据库排行榜:openGauss重夺榜眼,PolarDB反超人大金仓
phpstrom 快速注释:
Codeforces Round #276 (Div. 1) D. Kindergarten
中科院深圳先进技术院合成所赵国屏院士组2022年招聘启事
【学习笔记】Redis的持久化