MapleStory Finger Point

๐Ÿƒ‍โ™‚๏ธBaekjoon/Python

#25206 - python

HYEJU01 2024. 4. 20. 02:45
#ํ•™์  X ๊ณผ๋ชฉ ํ‰์  / ํ•™์ ์˜ ์ดํ•ฉ

object, score, rating = [],[],[]
rating_list = {"A+":4.5,"A0":4.0,"B+":3.5,"B0":3.0,"C+":2.5,"C0":2.0,"D+":1.5,"D0":1.0,"F":0.0}
score_sum = 0
scra = 0 # ํ•™์  X ๊ณผ๋ชฉ ํ‰์ 
cnt = 0

for _ in range (20) :
    object, score, rating = input().split()
    score = float(score)
    if rating != "P":
        scra += score*rating_list.get(rating)
        score_sum  += score

print(format(scra/score_sum,".6f"))

 

๐Ÿ’ฌ score ๊ฐ’์„ float ๋กœ ํ˜•๋ณ€ํ™˜ ํ•ด์ฃผ๊ธฐ

๐Ÿ’ฌ rating = ๋“ฑ๊ธ‰์ด P ์ผ ๊ฒฝ์šฐ์—๋Š” ๊ณ„์‚ฐํ•˜์ง€ ์•Š๋Š” ๋‹ค๋Š” ์กฐ๊ฑด ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ 

๐Ÿ’ฌ  ๋”•์…”๋„ˆ๋ฆฌ๋ฅผ ํ†ตํ•ด์„œ ํ‚ค : ๊ฐ’์„ ๊ฐ€์ ธ์˜ค๊ธฐ 

 

 

 

<< ๐Ÿคฎ ๋ง‰ํžŒ ์ด์œ  & ํ•ด๊ฒฐ  >>

object, score, rating = [],[],[]
rating_list = {"A+":4.5,"A0":4.0,"B+":3.5,"B0":3.0,"C+":2.5,"C0":2.0,"D+":1.5,"D0":1.0,"F":0.0}
score_sum = 0
scra = [] # ํ•™์  X ๊ณผ๋ชฉ ํ‰์ 
cnt = 0

for _ in range (20) :
    object, score, rating = input().split()
    if rating == "P":
        cnt += 1

for i in range (20-cnt):
    for _ in rating :
        scra = score[i]*rating_list.get(rating)
    score_sum  += score
    print(scra/score_sum)

์ด๊ฑด ์ ๋‹ค ๋ง‰ํžŒ ๋‚ด ์ฝ”๋“œ ... (์‹คํŒจํ•œ ์ฝ”๋“œ์ž„)

์ดˆ๋ฐ˜ ๊ตฌํ˜„์€ ์ด๋ ‡๊ฒŒ ํ•˜๊ณ  ๋‹ค๋ฅธ ๊ฑธ ์ฐพ์•„๋ณด๋ฉด์„œ ์ˆ˜์ •ํ•ด์คฌ๋‹ค.

์˜ค๋žœ๋งŒ์— ๋”•์…”๋„ˆ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•ด๋ดค๋‹ค!!

 

 

๐Ÿ’ฌ ๋”•์…”๋„ˆ๋ฆฌ .get(ํ‚ค)  => ํ‚ค์— ๋Œ€์‘ํ•˜๋Š” ๊ฐ’ ๋ฐ˜ํ™˜ 

๐Ÿ’ฌ format(result, ".6f")๋Š” 0.3141592 ๊ฐ’์„ ์†Œ์ˆ˜์  ์ดํ•˜ 6์ž๋ฆฌ๊นŒ์ง€ ํฌ๋งทํ•จ