HackerRank/ハッカーランキング-Find Angle MBC-python


質問する📖



に答える🙏

  • 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