HBC216012取数游戏,枚举Let'sPlayCurling题解

一沫阳光 算法基础篇 29 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
Two teams, Red and Blue, are competing on the number axis. After the game there are. c be the position of the center of the target area. From the description above we know that if there exists some

Curling is a sport in which players slide stones on a sheet of ice toward a target area. The team with the nearest stone to the center of the target area wins the game. Two teams, Red and Blue, are competing on the number axis. After the game there are (n+m) (n+m) stones remaining on the axis, n n of them for the Red team and the other m m of them for the Blue. The i i-th stone of the Red team is positioned at a_i a i ​ and the i i-th stone of the Blue team is positioned at b_i b i ​ . Let c c be the position of the center of the target area. From the description above we know that if there exists some i i such that 1 le i le n 1≤i≤n and for all 1 le j le m 1≤j≤m we have |c - a_i| < |c - b_j| ∣c−a i ​ ∣<∣c−b j ​ ∣ then Red wins the game. What's more, Red is declared to win p p points if the number of i i satisfying the constraint is exactly p p. Given the positions of the stones for team Red and Blue, your task is to determine the position c c of the center of the target area so that Red wins the game and scores as much as possible. Note that c c can be any real number, not necessarily an integer.

HBC216012取数游戏,枚举Let'sPlayCurling题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC216012取数游戏 枚举Let'sPlayCurling题解