BOJ - 1267 - 핸드폰 요금

Updated:

import sys

def Y(data):
    price = 0
    for i in data:
        price += ((i // 30) + 1) * 10

    return price

def M(data):
    price = 0
    for i in data:
        price += ((i // 60) + 1) * 15

    return price

def solution():    
    N = int(input())
    data = list(map(int, input().split(' ')))
    
    yPrice, mPrice = Y(data), M(data)
    if yPrice < mPrice:
        print("Y {0}".format(yPrice))
    elif yPrice > mPrice:
        print("M {0}".format(mPrice))
    else:
        print("Y M {0}".format(mPrice))

solution()

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

Categories:

Updated:

Leave a comment