QOJ.ac

QOJ

时间限制: 9 s 内存限制: 1024 MB 总分: 100

#3604. 太阳能

统计

你正计划在星际空间中航行,希望能找到宜居行星。你已经确定了 $N$ 颗可以为你的飞船太阳能电池板充电的恒星。剩下的唯一工作就是决定飞船的朝向,以使其航行距离最大化。

空间被建模为一个二维平面,地球位于原点。飞船可以从地球出发,沿直线向任意方向发射。如果飞船以与 $x$ 轴成 $a_i$ 角的方向发射,恒星 $i$ 可以提供足够的能量使其航行 $T_i$ 的距离。如果发射角度没有完全对准,飞船获得的能量就会减少。具体来说,如果发射方向与 $x$ 轴的夹角为 $a$,则从恒星 $i$ 处获得的航行距离为:

$$\max(0, T_i - s_i \cdot \text{dist}(a_i, a))$$

其中 $\text{dist}(a, b)$ 是从角度 $a$ 到 $b$ 所需的最小弧度差。飞船的总航行距离即为每颗恒星所贡献距离之和。请找出飞船可以航行的最大距离 $T$。

输入格式

第一行包含一个整数 $N$,$1 \le N \le 10^5$。接下来的 $N$ 行,每行包含三个实数 $T_i$、$s_i$ 和 $a_i$,其中 $0 < T_i \le 1\,000$,$0 \le s_i \le 100$,且 $0 \le a_i < 2\pi$。输入中的所有实数小数点后最多有 6 位。

输出格式

在一行中输出飞船可以航行的最大距离。如果你的答案与标准答案的绝对误差或相对误差不超过 $10^{-6}$,则被视为正确。

样例

样例输入 1

2
100 1 1
100 1 1.5

样例输出 1

199.500000

样例输入 2

4
100 1 0.5
200 1 1
100 0.5 1.5
10 2 3

样例输出 2

405.500000

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.