알고리즘
[백준 10951][Swift] 두 정수 A와 B를 입력받은 다음, A+B를 출력 -4
moving
2022. 3. 31. 16:08
728x90
코드
while let input = readLine() {
let inputNumber = input.split(separator: " ").map { Int($0)! }
print(inputNumber[0] + inputNumber[1])
}
EOF(End Of File) 문제
무한루프가 돌 때 어떻게 빠져나올지 묻는 문제
while true {
...
}
readLine() 자체를 true인지 false 인지 판단
control + d 로 빠져나오거나 enter 치면 빠져나옴
https://www.acmicpc.net/problem/10951