当前位置:网站首页>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,并输出结果.
代码:
边栏推荐
- 广东10个项目入选工信部2021年物联网示范项目名单
- NodeJs原理 - Stream(二)
- 矩阵键盘&基于51(UcosII)计算器小项目
- LeetCode中等题之比较版本号
- Guidelines for Sending Overseas Mail (2)
- 一个 CRM One Order Application log 的单元测试报表
- Inventory of Loudi Agricultural Products Inspection Laboratory Construction Guidelines
- 教育Codeforces轮41(额定Div。2)大肠Tufurama
- Keithley DMM7510精准测量超低功耗设备各种运作模式功耗
- 漏洞管理计划的未来趋势
猜你喜欢
随机推荐
Blast!ByteDance successfully landed, only because the interview questions of LeetCode algorithm were exhausted
Ethernet channel 以太信道
Reversing words in a string in LeetCode
iTextSharp 使用详解
Nanodlp v2.2/v3.0光固化电路板,机械开关/光电开关/接近开关的接法和系统状态电平设置
大佬们有遇到过这个问题吗? MySQL 2.2 和 2.3-SNAPSHOT 都这样,貌似是
BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection 论文笔记
M²BEV: Multi-Camera Joint 3D Detection and Segmentation with Unified Bird’s-Eye View Representation
Guidelines for Sending Overseas Mail (2)
11+ chrome高级调试技巧,学会效率直接提升666%
Efficient and Robust 2D-to-BEV Representation Learning via Geometry-guided Kernel Transformer 论文笔记
娄底农产品检验实验室建设指南盘点
燃炸!字节跳动成功上岸,只因刷爆LeetCode算法面试题
C#中导入其它自定义的命名空间
Network Saboteur
NodeJs原理 - Stream(二)
AtCoder Beginner Contest 077 D - Small Multiple
“68道 Redis+168道 MySQL”精品面试题(带解析)
Pod生命周期
表中存在多个索引问题? - 聚集索引,回表,覆盖索引









