[CodeForces] The Meaningless Game

Problem

 

S: the set of numbers said by player 1;

P: the set of numbers said by player 2;

S^2 * P = a;

S * P^2 = b;

a * b = (S * P)^3, so a * b must be a perfect cubic number. Binary search to check this.

Let X be the cubic root of a * b, X = S * P. 

In order to have a valid S and P, then a must be divisible by X and b must be divisible by X.

 

上一篇:高可用Redis(五):瑞士军刀之慢查询,Pipeline和发布订阅


下一篇:vb 监控电脑活动记录