It's a big accident.
** Thoughts ** Just do
n = input()
if n[-1] == '3':
print('bon')
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
print('pon')
else:
print('hon')
** Thoughts ** Just do
k = int(input())
s = input()
n = len(s)
if n <= k:
print(s)
else:
print(s[:k]+"...")
** Thoughts ** Calculate the angle between the hour and minute hands and use the cosine theorem. ← 6WA () misunderstanding the symmetry of cos. The value of cos is not symmetrical with respect to $ \ frac {\ pi} {2} $? What are you thinking? ~~ I can't do math for the exam even though I'm an examinee ~~
import math
a, b, h, m = map(int,input().split())
a_s = (30 * h) % 360 + 0.5 * m
b_s = (6*m)
s = max(a_s,b_s) - min(a_s,b_s)
ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(s)))
print(ans)
If you look at them in order from 1 and number each parent node (closer to 1), you can solve it. Is it BFS?
I am a small fish.
Recommended Posts