QOJ.ac

QOJ

Time Limit: 5.0 s Memory Limit: 1024 MB Total points: 100

#14420. This Time I Will Be Lucky

Statistics

ในคาสิโนแห่งหนึ่ง มีถุงที่บรรจุลูกบอลสีขาว $a$ ลูก และลูกบอลสีดำ $b$ ลูก จนกว่าถุงจะว่างเปล่า เราสามารถสุ่มหยิบลูกบอลหนึ่งลูกออกจากถุงได้ และหากเป็นสีขาว เราจะได้รับ $1$ ดอลลาร์ มิฉะนั้น เราจะเสีย $1$ ดอลลาร์ หลังจากนั้นเราจะทิ้งลูกบอลลูกนี้ไป เราสามารถหยุดเมื่อใดก็ได้ รวมถึงหยุดก่อนที่จะหยิบลูกบอลลูกใดๆ ด้วย เราจะได้รับกำไรคาดหมายสูงสุดเท่าใด?

ข้อมูลนำเข้า

ข้อมูลนำเข้าประกอบด้วยจำนวนเต็มสองจำนวนคั่นด้วยช่องว่าง คือ $a$ และ $b$ ($0 \le a, b \le 100\,000$)

ข้อมูลส่งออก

พิมพ์จำนวนจริงหนึ่งจำนวน: กำไรคาดหมายสูงสุด คำตอบจะถือว่าถูกต้องหากมีความคลาดเคลื่อนสัมบูรณ์หรือความคลาดเคลื่อนสัมพัทธ์ไม่เกิน $10^{-6}$

ตัวอย่าง

ข้อมูลนำเข้าตัวอย่าง 1

0 0

ข้อมูลส่งออกตัวอย่าง 1

0

ข้อมูลนำเข้าตัวอย่าง 2

3 4

ข้อมูลส่งออกตัวอย่าง 2

0.342857142857142857

ข้อมูลนำเข้าตัวอย่าง 3

2 2

ข้อมูลส่งออกตัวอย่าง 3

0.666666666666666666

ข้อมูลนำเข้าตัวอย่าง 4

3 0

ข้อมูลส่งออกตัวอย่าง 4

3

หมายเหตุ

อย่าลืมใช้ setprecision หากคุณใช้ภาษา C++

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.