문제풀이/BOJ

[Python] BOJ/백준 1267번 핸드폰 요금

서채리 2021. 6. 8. 02:35

[문제]

https://www.acmicpc.net/problem/1267

 

1267번: 핸드폰 요금

동호가 저번 달에 이용한 통화의 개수 N이 주어진다. N은 20보다 작거나 같은 자연수이다. 둘째 줄에 통화 시간 N개가 주어진다. 통화 시간은 10,000보다 작거나 같은 자연수이다.

www.acmicpc.net



[풀이]

 


[코드]

if __name__ == '__main__':
    n = int(input())
    time_li = [int(x) for x in input().split()]

    ys = 0
    ms = 0
    for i in time_li:
        ys += (i//30 + 1) * 10
        ms += (i//60 + 1) * 15

    if ys < ms:
        print("Y", ys)
    elif ys == ms:
        print("Y M", ms)
    else:
        print("M", ms)