๐Ÿ“ ์ฝ”ํ…Œ/BOJ

[Swift] ๋ฐฑ์ค€ 2475

JerryiOS 2023. 3. 22. 13:12

let input = readLine()!.split(separator: " ").map { Int($0)! * Int($0)! }.reduce(0, +)

print(input % 10)

์ˆซ์ž๋“ค์˜ ํ•ฉ์„ ๋”ํ• ๋•Œ๋Š” .reduce(0, +)๋ฅผ ์“ฐ๋ฉด ํŽธํ•˜๋‹ค.

๋ฐ˜์‘ํ˜•