Skip to content

Instantly share code, notes, and snippets.

@uchidama
Created August 5, 2021 04:55
Show Gist options
  • Save uchidama/7213bfa1083c43376f60ce041a95e62d to your computer and use it in GitHub Desktop.
Save uchidama/7213bfa1083c43376f60ce041a95e62d to your computer and use it in GitHub Desktop.
AtCoder Beginner Contest 144 [ D - Water Bottle ] https://atcoder.jp/contests/abc144/tasks/abc144_d
'''
[問題]
https://atcoder.jp/contests/abc144/tasks/abc144_d
数学問題
[解説]
https://blog.hamayanhamayan.com/entry/2019/10/27/233430
https://img.atcoder.jp/abc144/editorial.pdf
'''
import sys
import math
sys.setrecursionlimit(10 ** 6) # 再帰上限の引き上げ
input = sys.stdin.readline
INF = 2 ** 63 - 1
a, b, x = map(int, input().split())
# 水筒の体積の半分を計算
half = a * a * b / 2.0
if x < half:
# 水の体積が水筒の半分以下
y = 2 * x / ( a * b)
ans = math.atan(b / y)
else:
# 水の体積が水筒の半分以上
y = 2 * b - 2 * x / (a * a)
ans = math.atan(y / a)
ans = math.degrees(ans)
print(ans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment