Problem:


Score : 400 points

Problem Statement

Takahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\mathrm{cm} and whose height is b~\mathrm{cm}. (The thickness of the bottle can be ignored.)

We will pour x~\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.

When will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.

Constraints

All values in input are integers.

1 \leq a \leq 100

1 \leq b \leq 100

1 \leq x \leq a^2b

Input

Input is given from Standard Input in the following format:

a b x

Output

Print the maximum angle in which we can tilt the bottle without spilling any water, in degrees.
Your output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.

Sample Input 1

2 2 4

Sample Output 1

45.0000000000

This bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.

Sample Input 2

12 21 10

Sample Output 2

89.7834636934

This bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.

Sample Input 3

3 1 8

Sample Output 3

4.2363947991

This bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.



Sample input:
2 2 4


Sample output:
45.0000000000

Submission status: Runtime Error

Solution code:
#%%
import math 

a, b, x = map(int, input().split())
if x >= a*a*b/2:
    y = 2*(b-x/(a**2))
    ans = math.degrees(math.atan(a/y))
    print(90 - ans)
else:
    y = 2*(x/(a*b))
    ans = math.degrees(math.atan(y/b))
    print(90 - ans)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
import math

a,b,x=map(int,input().split())

if x<=(a**2)*b/2:
    t=a-(a-(2*x)/a/b)
    ans=math.atan(b/t)
    ans=math.degrees(ans)
    
    print(ans)
else:
    
    t=2*(b-x/(a**2))
    ans=math.atan(a/t)
    ans=math.degrees(ans)
    
    print(90-ans)

Submission status: Runtime Error

Solution code:
import numpy as np

a,b,x=[int(x) for x in input().split()]
if x*2<=a**2*b:
    y=2*x
    theta=np.arctan2(y,b*a*b)
else:
    theta=np.arctan2(a**3, 2*(b*a**2-x) )
print(90-theta*180/np.pi)

Submission status: Runtime Error

Solution code:
import math
a,b,x =map(int,input().split( ))
if x >= (a**2*b/2):
    k=2*x/(a**2)-b
    cos=math.sqrt((b-k)**2/((a**2)+(b-k)**2))
    print(math.degrees(math.acos(cos)))
else:
    k=2*x/(a*b)
    cos=math.sqrt(b**2/(b**2+k**2))
	print(90-math.degrees(math.acos(cos)))

Submission status: Runtime Error

Solution code:
a, b, x = map(int, input().split())

if x <= a**2*b/2:
  t = (2*x)/(a*b**2)
else:
  t = (a**3)/(2*(a**2*b-x))
#print(t)

import math
a = math.atan(t)
a = math.degrees(a)
print(90-a)

Submission status: Runtime Error

Solution code:
import math

def main():
    abx = list(map(int,input().split()))
    ans = 2 * ((a * a * b) - x) / (a * a * a)
    print(math.degrees(math.atan(ans)))

main()

Submission status: Runtime Error

Solution code:
import math

a,b,x = map(int,input().split())

if x < a*a*b/2:
    print(90-math.degrees(math.atan(2*x/(a * (b**2)))))
    
else:
    print(90-math.degrees(math.atan(a**3 / (2*(a*a*b-x)))))

Submission status: Runtime Error

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from math import degrees, atan

a, b, x = li()
c = x / (a*a)

if a * c > (a * b) / 2:
    print(90 - degrees(atan((a / (2*(b-c))))))
else:
    print(90 - degrees(atan(2*a*c / (b**2))))

Submission status: Runtime Error

Solution code:
import math

a, b, x = list(map(int, input().split()))
if a**2*b/2 < x:
    h = 2*x/(a**2)-b
    theta = math.atan(a/(b-h))
else:
    h = 2*x/a/b
    theta = math.atan(h/b)

print(90 - math.degrees(theta))

Submission status: Runtime Error

Solution code:
import sys
import math
a, b, x = [int(i) for i in sys.stdin.readline().split()]
if x < a**2*b / 2:
    print(90.0 - math.degrees(math.atan(x / (a*b**2/2))))
else:
    print(90.0 - math.degrees(math.atan(a**3 / 2 / (a**2*b-x))))

Submission status: Runtime Error

Solution code:
from math import atan,pi
a,b,x=map(int,input().split())
if a**2*b>=2*x:
    print(90-atan(2*x/(a*b**2))*180/pi)
else:
    print(90-atan(a**3/(2*a**2*b-2*x))*180/pi)

Submission status: Runtime Error

Solution code:
import math
a,b,x=map(int,input().split())

if a*a*b%2==0:
  if a*a*b//2==x:
    print(0)
    exit()

if a*a*b/2>x:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
  print(90-math.degrees(math.atan(a/(2*b-2*x/a/a))))

Submission status: Runtime Error

Solution code:
a,b,x = [int(x) for x in input().split()]
sq = x/a
sq2 = a*b - sq
if sq2 <= a*b/2:
  line = sq2*2/a
  import math 
  #print(sq,sq2,line)
  t = 90-math.degrees(math.atan(a/line))
  print(t)
else:
  line = sq*2/b
  import math 
  #print("a",sq,sq2,line)
  t = 90-math.degrees(math.atan(line/b))
  print(t)

Submission status: Runtime Error

Solution code:
import math
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10**7)
a, b, x = map(int, input().split())

if a*a*b/2 < x:
    l = 2*b - 2*x/(a*a)
    print(90 - math.degrees(math.atan(a/l)))

elif a*a*b/2 == x:
    print(90 - math.degrees(math.atan(a/b)))

else:
    l = 2*x / (a*b)
    print(90 - math.degrees(math.atan(l/b)))

Submission status: Runtime Error

Solution code:
import math

a,b,x = map(int,input().split())


if a*a*b>2*x:
	print(90- math.atan(2*x/(a*b*b) *360/(2*math.pi)))
else:
	print(90- math.atan(a**3/(2*(a*a*b-x))) *360/(2*math.pi))

Submission status: Runtime Error

Solution code:
import sys
import math
a, b, x = [int(i) for i in sys.stdin.readline().split()]
if x <= a**2*b / 2:
    print(90 - math.degrees(math.atan(x / (a*b**2/2))))
else:
    print(90 - math.degrees(math.atan(a**3 / 2 / (a**2*b-x))))

Submission status: Runtime Error

Solution code:
import math
a,b,x=map(int,input().split())

if a*a*b/2>=x:
  if a*a*b/2==x:
    print(0)
  else:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
  print(90-math.degrees(math.atan(a/(2*b-2*x/a/a))))

Submission status: Runtime Error

Solution code:
# coding: utf-8
import math
a, b, x = map(int, input().split())
h = x / a ** 2
l = 2 * a * h / b
if l <= a:
    print(math.degrees(math.atan2(b, l)))
else:
    k = 2 * h - b
    m = a * b / (k - b)
    print(90 + math.degrees(math.atan2(m, b)))

Submission status: Runtime Error

Solution code:
a,b,x=map(int,input().split())
import math
if a*a*b/2==x:
  c=math.pi/2
elif a*a*b/2>=x:
  c=math.atan((2*x)/(a*b*b))
else:
  c=math.atan(a**3/(2*a*a*b-2*x))
d=math.degrees(c)
print(90-d)

Submission status: Runtime Error

Solution code:
a, b, x = [ int(v) for v in input().split() ]
v = a*a*b

if x < v/2:
    print(math.atan(b*b*a/(2*x))*(180/math.pi))
else:
    print(math.atan(2*(v-x)/(a**3))*(180/math.pi))

Submission status: Runtime Error

Solution code:
import math
a,b,x=map(int,input().split())

if a*b//2*a>=x:
  print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
  print(90-math.degrees(math.atan(a/(2*b-2*x/a/a))))

Submission status: Runtime Error

Solution code:
from math import atan, degrees

a, b, x = map(int, input().split())
V = a * a * b // 2

if V >= x:
    #print('V >= x')
    l = (2 * x) / (a * b)
    theta = 90 - degrees(atan(l / b))
else:
    h = ((2 * x) / (a * a)) - b
    theta = 90 - degrees(atan(a / (b - h)))

print(theta)

Submission status: Runtime Error

Solution code:
import math
a,b,x=map(int,input().split())
ans = 0
if a*a*b/2 >= x:
    x/=a
    x=x*2/b
    ans = math.atan(x/b)
else:
    x/=a*a
    x=(b-x)*2
    ans = math.atan(a/x)
print(90-ans/math.pi*180)

Submission status: Runtime Error

Solution code:
import math
a,b,x = list(map(int,input().split()))
h = x/(a**2)
if h<=b/2:
    ans =  math.degrees(math.atan(b**2/(2*a*h)))
else:
    ans = 90-math.degrees(math.atan(a/(2*(b-h))))
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

a,b,x = map(int, input().split())

v = a*a*b

if v == x:
    print(0)
    exit(0)

h = (2*x)/(a*a)

t = np.arctan(h/a)

print(t*180/np.pi)

Submission status: Runtime Error

Solution code:
a,b,x=map(int,input().split())
import math
if a*a*b/2>=x:
  c=math.atan((2*x)/(a*b*b))
else:
  c=math.atan(a**3/(2*a*a*b-2*x))
d=math.degrees(c)
print(90-d)

Submission status: Runtime Error

Solution code:
import math
a, b, x = map(int, input().split())

half = a * a * b / 2
theta = 0.
if half < x:
    temp = a*a*b-x
    temp = temp * 2 / (a*a*a)
    theta = math.atan(temp)
else:
    temp = a*b*b/2/x
    theta = math.atan(temp)

res = theta * 180 / math.acos(-1)
print(f'{res:.10f}')

Submission status: Runtime Error

Solution code:
import math

a, b, x = map(int, input().split())
t1 = x * (2/(a*(b**2)))
t2 = a/(2 * b - x * (2/(a**2)))
if t1 < (a/b):
  print(90.-math.degrees(math.atan(t1)))
else:
  print(90.-math.degrees(math.atan(t2)))

Submission status: Runtime Error

Solution code:
import numpy as np
a,b,x=map(int,input().split())
if a*a*b>=x*2:
    c=2*x/(a*b)
    d=c**2+b**2
    d=d**(1/2)
    ans=np.arccos(c/d)
    print(ans*180/3.1415926535)
else:
    x=a*a*b-x
    c=2*x/(a*a)
    d=c**2+a**2
    d=d**(1/2)
    ans=np.arccos(a/d)
    print(ans*180/3.1415926535)

Submission status: Runtime Error

Solution code:

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter
from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np

import sys
def input():
	return sys.stdin.readline().strip()

a, b, x = list(map(int, input().split()))

if x <= (a**2)*b / 2:
	shita = math.degrees(math.atan(a*(b**2)/(2*x)))
else:
	shita = math.degrees(math.atan( 2*((a**2)*b - x)/(a**3) ))

print(shita)

Submission status: Runtime Error

Solution code:
from numpy import arctan, pi

def main():
    a, b, x = map(int, input().split())
    if a ** 2 * b > 2 * x:
        ans = arctan(2*x/(a*b*b))
    elif a ** 2 * b < 2 * x:
        ans = arctan(a*a*a/2/(a*a*b-x))
    else:
        ans = arctan(a/b)
    print(90 - ans*180/pi)


if __name__ == '__main__': main()

Submission status: Runtime Error

Solution code:
W, H, X = map(int, input().split())
X /= W
import math
angle = 90 - math.atan(2*X/pow(H,2)) * 180/math.pi
if angle >= 45:
    print(angle)
else:
    angle = 90 - math.atan(W*W/(2*(W*H-X))) * 180/math.pi
    print(angle)

Submission status: Runtime Error

Solution code:
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
input = sys.stdin.readline
a,b,x= map(float,input().split())
if x > a*a*b/2:
    left = (x-a*a*b/2)/a
    tei = left*2/a
    left1 = b-tei
    ans = math.atan(a/left1)
    print(90-math.degrees(ans))
else:
    left = x/a
    tei = left*2/b
    ans = math.atan(b/tei)
    print(math.degrees(ans))

Submission status: Runtime Error

Solution code:
import math
a, b, x = map(int, input().split())
y = a*a*b - x

if (a*a*b/2 < x):
  print(90-math.degrees(math.atan((a**3)/(2*y))))
else:
  print(90-math.degrees(math.atan((2*x)/(a* b**2))))

Submission status: Runtime Error

Solution code:
from math import atan, degrees


def main():
    a, b, x = map(int, input().split())

    full = a * a * b
    half = full * 0.5

    if x <= half:
        s = x / a
        ans = 90 - degrees(atan(2 * s / b ** 2))

    else:
        s = (full - x) / a
        ans = 90 - degrees(atan(a ** 2 / (2 * s)))

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
from sys import stdin
import math

a, b, x = [int(x) for x in stdin.readline().rstrip().split()]

if 2 * x >= (a ** 2) * b:
    v = (a ** 2) * b - x
    c = (2 * v) / (a ** 2)
    print(90 - math.atan(a / c) * 180 / math.pi)
else:
    c = 2 * x / (a * b)
    print(math.atan(b / c) * 180 / math.pi)

Submission status: Runtime Error

Solution code:
import math
a,b,x=map(int,input().split())
h=x/(a*a)
if 2*x>=a*a*b:
    print(90-math.atan(a/(b-h)/2)/math.pi*180)
else:
    print(90-math.atan(2*a*h/b/b)/math.pi*180)

Submission status: Runtime Error

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

a,b,x = II()

h = (x-a**2*b/2)*2/(a**2)
if h>=0:
    r = math.degrees(math.atan(a/(b-h)))
    print(90-r)
else:
    z = 2*x/(a*b)
    r = math.degrees(math.atan(z/b))
    print(90-r)

Submission status: Runtime Error

Solution code:
import math
a, b, x = map(int, input().split())
s = x / a
if s > a * b / 2:
  rad = math.atan(a ** 3 / (2 * a * a * b - 2 * x))
  print(90 - (rad * 180 / math.pi))
else:
  rad = math.atan(a * b * b / (2 * x))
  print(rad * 180 / math.pi)

Submission status: Runtime Error

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

from decimal import Decimal

a,b,x = II()

h = Decimal((x-a**2*b/2)*2/(a**2))
if h>=0:
    r = math.degrees(math.atan(a/(b-h)))
    print(90-r)
else:
    z = Decimal(2*x/(a*b))
    r = math.degrees(math.atan(z/b))
    print(90-r)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys, math


def solve(a: int, b: int, x: int):
    r = 1/2 * a**2 * b
    if x >= r:
        tan = a**3/(2*(a**2*b-x))
    else:
        tan = (2*x)/(a*b**2)
    print(90-math.degrees(math.atan(tan)))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    solve(a, b, x)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math

a,b,x = map(int,input().split())

if x <= a*a*b/2:
    S = x/a
    f = 2*S/b
    print(math.degrees(math.atan(b/f)))
else:
    S = a*b- x/a
    f = 2*S/a
    print(90-math.degrees(math.atan(a/f)))

Submission status: Runtime Error

Solution code:
from math import atan, degrees
a, b, x = map(int, input().split())
if x<=a*a*b//2:
  tan = (2*x)/(a*b*b)
  print(90-degrees(atan(tan)))
else:
  m = a*b*a-x
  tan = a*a*a/(2*m)
  print(90-degrees(atan(tan)))

Submission status: Runtime Error

Solution code:
import sys,collections as cl,bisect as bs,math 
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def prime_decomposition(n): #素因数分解
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table

def make_divisors(n): #約数列挙
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors




a,b,x = m()

if x >= a*a*b/2:
    kkk = 2 * x / (a**2) - b

    on = b - kkk

    k = math.degrees(math.atan(a/on))
    print(90-k)
else:
    kkk = 2*x/(a*b)

    k = math.degrees(math.atan(b/kkk))
    print(k)

Submission status: Runtime Error

Solution code:
import math
a,b,c=map(int,input().split())
d=b-c/(a**2)
d=d*2
if d==0:
  print(0)
if d>a:
  e=c*2/(a*b)
  print(90-math.degrees(math.atan(e/b)))
else:
  print(90-math.degrees(math.atan(a/d)))

Submission status: Runtime Error

Solution code:
#%%

#%%
n = int(input())

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

l = factorize(n)


import itertools
c = list(itertools.product(range(2), repeat=len(l)))
#print(c)

flag = False
k = 10**15
for i in range(len(c)):
    a = 1
    b = 1
    for j in range(len(c[i])):
        if c[i][j] == 0:
            a *= l[j]
        else:
            b *= l[j]
    k = min(k, a+b)
    

print(k-2)

Submission status: Runtime Error

Solution code:
N = int(input())
ret = 1 - 1 + N - 1
for div in range(2, int(N ** 0.5) + 1):
    if N % div != 0: continue
    ret = min(ret, div - 1 + N // div - 1)
print(ret)