๋ฐฑ์ค 25206๋ฒ ๋ฌธ์
20๊ฐ ๋ค์ด์ค๋ ์ ๋ ฅ (๊ณผ๋ชฉ๋ช , ํ์ , ๋ฑ๊ธ)์ ๊ฐ์ง๊ณ ์ ๊ณตํ์ ์ ๊ณ์ฐํ๋ ์ฝ๋๋ฅผ ์์ฑํ๋ค.
๋ฑ๊ธ์ A+, A0, B+, ... F
๊น์ง์ด๋ฉฐ ์ ๊ณตํ์ = (ํ์ X ๊ณผ๋ชฉํ์ ) / ์ด ํ์
๊ณผ๋ชฉํ์ ์ ๋ฑ๊ธ์ ํตํด ๊ณ์ฐํ ์ ์๊ฒ ๋ฌธ์ ์์ ํ๋ก ์ ๊ณตํ๋ค.
๋ฑ๊ธ์ค์ P๋ฑ๊ธ์ ๋ฐ์ผ๋ฉด ๊ณ์ฐ์์ ์ ์ธ (๊ณผ๋ชฉํ์ ์ด๋ ์ดํ์ ๊ณ์ฐํ ๋) ํ๋ค.
import sys
input = sys.stdin.readline
total = 0
total_score = 0
for i in range(20):
name, score, clas = map(str, input().split())
score = float(score)
if clas != 'P':
total_score += score
if clas == 'A+':
total += (score * 4.5)
elif clas == 'A0':
total += (score * 4.0)
elif clas == 'B+':
total += (score * 3.5)
elif clas == 'B0':
total += (score * 3.0)
elif clas == 'C+':
total += (score * 2.5)
elif clas == 'C0':
total += (score * 2.0)
elif clas == 'D+':
total += (score * 1.5)
elif clas == 'D0':
total += (score * 1.0)
else:
total += (score * 0.0)
# p์ f
print('%.6f' % (total / total_score))
์ถ๋ ฅ ๊ฐ์ ์์ 6๋ฒ์งธ ์๋ฆฟ์๊น์ง ์ถ๋ ฅํด์ผ ํ๋ค.
๋ฌธ์ ์ค์ Pํ์ ์ด ์ ์ธ๋๋ค๋ ๋ถ๋ถ์ ์ฝ์ง ๋ชปํ์ฌ ํด๊ฒฐํ๋๋ฐ ์๊ฐ์ด ๊ฑธ๋ ธ๋ค..(์ด์ด์..)