Bibi's DevLog ๐Ÿค“๐ŸŽ

[๋ฐฑ์ค€ 2490] ์œท๋†€์ด ๋ณธ๋ฌธ

ํ”„๋กœ๊ทธ๋ž˜๋ฐ/์•Œ๊ณ ๋ฆฌ์ฆ˜ ํ’€์ด Swift

[๋ฐฑ์ค€ 2490] ์œท๋†€์ด

๋น„๋น„ bibi 2022. 9. 13. 11:01

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

 

2490๋ฒˆ: ์œท๋†€์ด

์šฐ๋ฆฌ๋‚˜๋ผ ๊ณ ์œ ์˜ ์œท๋†€์ด๋Š” ๋„ค ๊ฐœ์˜ ์œท์ง์„ ๋˜์ ธ์„œ ๋ฐฐ(0)์™€ ๋“ฑ(1)์ด ๋‚˜์˜ค๋Š” ์ˆซ์ž๋ฅผ ์„ธ์–ด ๋„, ๊ฐœ, ๊ฑธ, ์œท, ๋ชจ๋ฅผ ๊ฒฐ์ •ํ•œ๋‹ค. ๋„ค ๊ฐœ ์œท์ง์„ ๋˜์ ธ์„œ ๋‚˜์˜จ ๊ฐ ์œท์ง์˜ ๋ฐฐ ํ˜น์€ ๋“ฑ ์ •๋ณด๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ ๋„(๋ฐฐ ํ•œ

www.acmicpc.net

0์ด 1๊ฐœ = ๋„ = A

0์ด 2๊ฐœ = ๊ฐœ = B

0์ด 3๊ฐœ = ๊ฑธ = C

0์ด 4๊ฐœ = ์œท = D

0์ด 0๊ฐœ = ๋ชจ = E

 

(1...3).forEach { _ in
    let input = readLine()!.split(separator: " ")
    let upperCount = input.filter { $0 == "0" }.count
    switch upperCount {
       case 1:
           print("A")
       case 2:
           print("B")
       case 3:
           print("C")
       case 4:
           print("D")
       case 0:
           print("E")
       default:
           break
    }
}