[백준/파이썬] 8932번 7종 경기 풀이

업데이트:



문제 정보


풀이

문제

7개 종목 기록이 주어질 때 종목별 공식으로 점수를 계산해 총합을 구하는 문제입니다.

코드

s={'a':9.23076,'b':26.7,'c':1.835,'type':'t'},{'a':1.84523,'b':75,'c':1.348,'type':'f'},{'a':56.0211,'b':1.5,'c':1.05,'type':'f'},{'a':4.99087,'b':42.5,'c':1.81,'type':'t'},{'a':0.188807,'b':210,'c':1.41,'type':'f'},{'a':15.9803,'b':3.8,'c':1.04,'type':'f'},{'a':0.11193,'b':254,'c':1.88,'type':'t'}
for T in range(int(input())):
    l=list(map(int,input().split()))
    r=0
    for i in range(len(l)):
        if s[i]['type']=='t':r+=int(s[i]['a']*(s[i]['b']-l[i])**s[i]['c'])
        else:r+=int(s[i]['a']*(l[i]-s[i]['b'])**s[i]['c'])
    print(r)

설명

트랙(t)과 필드(f) 공식을 구분해 각 종목 점수를 계산한 뒤 정수 부분 합계를 출력합니다.



댓글남기기