diff --git a/code_study/Baekjoon/swift/2460.swift b/code_study/Baekjoon/swift/2460.swift new file mode 100644 index 0000000..0d087e7 --- /dev/null +++ b/code_study/Baekjoon/swift/2460.swift @@ -0,0 +1,14 @@ +var ans: Int = 0 +var cur: Int = 0 + +for _ in 0...9 { + guard let info = readLine() else { break } + + let io = info.split(separator : " ").compactMap{Int($0)} + guard io.count == 2 else { break } + + cur += io[1] - io[0] + ans = max(ans, cur) +} + +print(ans) \ No newline at end of file