HackerRank/해커랭크-Find Angle MBC-python

cosmos·2021년 4월 6일
2
post-thumbnail
post-custom-banner

문제📖

풀이🙏

  • The first line contains the length of side AB.
  • The second line contains the length of side BC.
  • Output MBC in degrees.
    -> Use (round function and atan2 function) of math module

코드💻

# hackerRank, Find Angle MBC, python3
import math
import sys

def solution(y, x):
    return str(round(math.atan2(y, x) * 180 / PI)) + '°'

if __name__ == "__main__":
    PI = 3.1415926535
    y = int(sys.stdin.readline())
    x = int(sys.stdin.readline())

    print(solution(y, x))

결과😎

출처 && 깃허브📝

https://www.hackerrank.com/challenges/find-angle/problem
github

post-custom-banner

0개의 댓글