MUKER_DEV with iOS

[swift] ๋ฐฑ์ค€ 2480๋ฒˆ - ์ฃผ์‚ฌ์œ„ ์„ธ๊ฐœ ๋ณธ๋ฌธ

๐Ÿค– ์•Œ๊ณ ๋ฆฌ์ฆ˜/BAEKJOON

[swift] ๋ฐฑ์ค€ 2480๋ฒˆ - ์ฃผ์‚ฌ์œ„ ์„ธ๊ฐœ

MUKER 2022. 8. 22. 12:24
 

2480๋ฒˆ: ์ฃผ์‚ฌ์œ„ ์„ธ๊ฐœ

1์—์„œ๋ถ€ํ„ฐ 6๊นŒ์ง€์˜ ๋ˆˆ์„ ๊ฐ€์ง„ 3๊ฐœ์˜ ์ฃผ์‚ฌ์œ„๋ฅผ ๋˜์ ธ์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ทœ์น™์— ๋”ฐ๋ผ ์ƒ๊ธˆ์„ ๋ฐ›๋Š” ๊ฒŒ์ž„์ด ์žˆ๋‹ค.  ๊ฐ™์€ ๋ˆˆ์ด 3๊ฐœ๊ฐ€ ๋‚˜์˜ค๋ฉด 10,000์›+(๊ฐ™์€ ๋ˆˆ)×1,000์›์˜ ์ƒ๊ธˆ์„ ๋ฐ›๊ฒŒ ๋œ๋‹ค.  ๊ฐ™์€ ๋ˆˆ์ด 2๊ฐœ

www.acmicpc.net


๋‚ด๊ฐ€ ์ฒ˜์Œ ํ‘ผ ํ’€์ด

var input = readLine()!.split(separator: " ").map { Int($0)! }

let dice1 = input[0]
let dice2 = input[1]
let dice3 = input[2]
var top = 0

for i in input {
    if i > top {
        top = i
    }
}

if dice1 == dice2 && dice2 == dice3 {
    print( 10000 + dice1 * 1000)
} else if dice1 == dice2 || dice1 == dice3 {
    print( 1000 + dice1 * 100)
} else if dice2 == dice3 {
    print( 1000 + dice2 * 100)
} else {
    print(top * 100)
}

69104kb, 8ms, 436b