Logo
(追記) (追記ここまで)

31304번 - Garden of Thorns 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB40232275.862%

문제

Eddy owns a rectangular garden and has noticed some trespassers stomping through his garden. There are some plants that he wants to protect. He hires an assistant, Zyra, to patrol and protect his garden.

Zyra cannot be bothered to monitor his garden, so she plants a circle of thorns centered at a randomly chosen location within the boundaries of his garden. A plant is considered protected if it is strictly inside the circle of thorns - that is, the distance from the plant to the center of the circle of thorns is less than the circle's radius. The circle of thorns may extend outside of the boundary of the rectangular garden, though all plants will be inside or on the boundary of the garden.

Given the random nature of the placement of Zyra's circle of thorns, compute the expected value of the plants that will be protected. Note that Zyra's circle of thorns does not have to be centered at integer coordinates.

입력

The first line of input contains four integers $n$ (1ドル \le n \le 10$), $r$ (1ドル \le r \le 2,000円$), $w$ and $h$ (1ドル \le w,h \le 1,000円$), where $n$ is the number of plants in Eddy's garden, $r$ is the radius of Zyra's circle of thorns, $w$ is the width of Eddy's garden and $h$ is the height of the garden.

Each of the next $n$ lines contains three integers $x$ (0ドル \le x \le w$), $y$ (0ドル \le y \le h$) and $v$ (1ドル \le v \le 1,000円$), where $(x,y)$ denotes the position of a plant from the lower left corner of Eddy's garden, and $v$ is the value of that plant. No two plants will be at the same position.

출력

Output a single real number, which is the expected value of plants which will be protected by Zyra's circle of thorns. Any answer within an absolute or relative error of 10ドル^{-9}$ will be accepted.

제한

예제 입력 1

3 50 100 100
30 10 3
40 10 7
50 90 8

예제 출력 1

8.41906486932450803806204930879

예제 입력 2

2 5 3 4
0 0 10
3 4 15

예제 출력 2

25.0

힌트

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2023 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /