https://www.acmicpc.net/problem/10039
고차 함수를 이용해 인풋을 받는 방법을 사용하면 코드를 줄일수 있다
import Foundation
var total = 0
for _ in 0...4{
var a = Int(readLine()!)!
a = a<=40 ? 40:a
total += a
}
print(total/5)
print((1...5).map{ _ in max(Int(readLine()!)!,40)}.reduce(0){$0+$1}/5)
한줄로 간단하게 끝나는 모습이다.