当前位置:网站首页>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,并输出结果.
代码:
边栏推荐
- mSystems | 中农汪杰组揭示影响土壤“塑料际”微生物群落的机制
- LeetCode·297.二叉树的序列化与反序列化·DFS·BFS
- 递归递推之Fighting_小银考呀考不过四级
- Redis 定长队列的探索和实践
- 生成树协议STP(Spanning Tree Protocol)
- 11+ chrome高级调试技巧,学会效率直接提升666%
- 接口自动化测试基础篇
- 跨域的五种解决方案
- Twikoo腾讯云函数部署转移到私有部署
- Efficient and Robust 2D-to-BEV Representation Learning via Geometry-guided Kernel Transformer Paper Notes
猜你喜欢
随机推荐
Nanodlp v2.2/v3.0光固化电路板,机械开关/光电开关/接近开关的接法和系统状态电平设置
表中存在多个索引问题? - 聚集索引,回表,覆盖索引
来看Prada大秀吗?在元宇宙里那种!
MySQL面试题整理
BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection Paper Notes
Keithley DMM7510 accurate measurement of ultra-low power consumption equipment all kinds of operation mode power consumption
Efficient and Robust 2D-to-BEV Representation Learning via Geometry-guided Kernel Transformer Paper Notes
Loudi Sewage Treatment Plant Laboratory Construction Management
Prada, big show?In the yuan in the universe that!
大佬们有遇到过这个问题吗? MySQL 2.2 和 2.3-SNAPSHOT 都这样,貌似是
递归递推之计算组合数
iTextSharp 使用详解
H264 码率控制
啥?他一个人写了个价值100万的软件,却用来开源了!
Jiugongge lottery animation
BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection 论文笔记
AtCoder Beginner Contest 077 D - Small Multiple
金山云要飘到哪里?
Jenkins修改端口号, jenkins容器修改默认端口号
Codeforces Round #276 (Div. 1) B. Maximum Value