Solve ABC168 A ~ C with Python

Introduction

It's a big accident.

A problem

Problem

** 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')

B problem

Problem

** Thoughts ** Just do

k = int(input())
s = input()
n = len(s)

if n <= k:
    print(s)
else:
    print(s[:k]+"...")

C problem

Problem

** 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)

D problem

If you look at them in order from 1 and number each parent node (closer to 1), you can solve it. Is it BFS?

Summary

I am a small fish.

Recommended Posts

Solve ABC163 A ~ C with Python
Solve ABC168 A ~ C with Python
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
Solve ABC158 A ~ C with Python
Solve ABC166 A ~ D with Python
Solve ABC036 A ~ C in Python
Solve ABC037 A ~ C in Python
Solve ABC175 A, B, C in Python
[AtCoder] Solve ABC1 ~ 100 A problem with Python
Solve AtCoder ABC168 with python (A ~ D)
Solve AtCoder ABC166 with python
ABC163 C problem with python3
ABC188 C problem with python3
Solve AtCoder ABC 186 with Python
ABC187 C problem with python
[AtCoder] Solve A problem of ABC101 ~ 169 with Python
Challenge AtCoder (ABC) 164 with Python! A ~ C problem
ABC127 A, B, C Explanation (python)
ABC166 in Python A ~ C problem
Solved AtCoder ABC 114 C-755 with Python3
ABC128 A, B, C commentary (python)
ABC126 A, B, C Explanation (python)
Solve Atcoder ABC176 (A, B, C, E) in Python
[AtCoder explanation] Control ABC180 A, B, C problems with Python!
[AtCoder explanation] Control ABC188 A, B, C problems with Python!
[AtCoder explanation] Control ABC158 A, B, C problems with Python!
[AtCoder explanation] Control ABC164 A, B, C problems with Python!
[AtCoder explanation] Control ABC168 A, B, C problems with Python!
I wanted to solve ABC160 with Python
Solve ABC165 A, B, D in Python
I wanted to solve ABC172 with Python
Solve AtCoder 167 with python
Solve Sudoku with Python
Solve ABC169 in Python
ABC147 C --HonestOrUnkind2 [Python]
Solve POJ 2386 with python
I wanted to solve the ABC164 A ~ D problem with Python
Solve A ~ D of yuki coder 247 with python
[AtCoder explanation] Control the A, B, C problems of ABC182 with Python!
[AtCoder explanation] Control the A, B, C problems of ABC186 with Python!
[AtCoder explanation] Control the A, B, C problems of ABC185 with Python!
Solve with Ruby, Perl, Java and Python AtCoder ABC 047 C Regular Expression
[AtCoder explanation] Control the A, B, C problems of ABC187 with Python!
[AtCoder explanation] Control the A, B, C problems of ABC184 with Python!
AtCoder ABC 178 Python (A ~ E)
Solve ABC176 E in Python
ABC memorandum [ABC163 C --managementr] (Python)
AtCoder ABC 176 Python (A ~ E)
Solve ABC175 D in Python
Make a fortune with Python
AtCoder ABC 182 Python (A ~ D)
Create a directory with python
Try embedding Python in a C ++ program with pybind11
Make a breakpoint on the c layer with python
[AtCoder explanation] Control the A, B, C, D problems of ABC183 with Python!
[AtCoder explanation] Control the A, B, C, D problems of ABC181 with Python!
[Python] What is a with statement?
solver> Link> Solve Excel Solver with python
ABC memorandum [ABC159 C --Maximum Volume] (Python)
Embed a Python interpreter into a C ++ app with pybind11 + cmake