QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 2048 MB Total points: 100

#8861. 汚染の解決

Statistics

Aqueous Contaminate Management の従業員であるあなたは、川や湖、海に(事故によって、あるいは意図的に)流される汚染物質を監視しなければなりません。あなたの仕事の一つは、サンゴ礁や産卵場など、水中のさまざまな生態系に汚染が及ぼす影響を測定することです。

problem_8861_35cb540bd1e9664d37dd121e92f38cfb.png

図 J.1:入力例 1 の図。

分析に使うモデルを図 J.1 に示します。海岸線(図の水平線)は $x$ 軸上にあり、汚染源は原点 $(0,0)$ にあります。水中への汚染の広がりは半円で表し、対象の生態系は多角形で表します。求めるのは、生態系のうち汚染された部分の面積、すなわち図の濃い青色の領域の面積です。

入力

入力は一つのテストケースからなります。テストケースの最初の行には二つの整数 $n$ と $r$ が与えられます。$3 \le n \le 100$ は多角形の頂点数、$1 \le r \le 1\,000$ は汚染範囲の半径です。続く $n$ 行にはそれぞれ二つの整数 $x_i, y_i$ が与えられ、多角形の頂点の座標を反時計回りの順に示します。$-1\,500 \le x_i \le 1\,500$、$0 \le y_i \le 1\,500$ です。多角形は自己交差も自己接触もしません。円周上に頂点はありません。

出力

原点を中心とする半径 $r$ の半円内に含まれる多角形の面積を出力してください。絶対誤差は $10^{-3}$ 以下でなければなりません。

入出力例

入力 1

6 10
-8 2
8 2
8 14
0 14
0 6
-8 14

出力 1

101.576437872

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.