while
-
[백준 10951] [Kotlin] A+B - 4백준 알고리즘 2021. 7. 15. 09:44
import java.io.* import java.util.StringTokenizer fun main() { val br = BufferedReader(InputStreamReader(System.`in`)) try { while (true) { val line = br.readLine() if (line == null) { break } else { val st = StringTokenizer(line) val a = st.nextToken().toInt() val b = st.nextToken().toInt() println("${a+b}") } } br.close() } catch (e: java.lang.Exception) { e.printStackTrace() } } 메모리 시간 언어 코드 ..
-
[백준 10952] [Kotlin] A+B - 5백준 알고리즘 2021. 7. 15. 09:38
import java.io.* import java.util.StringTokenizer fun main() { val br = BufferedReader(InputStreamReader(System.`in`)) val bw = BufferedWriter(OutputStreamWriter(System.out)) try { while (true) { var st = StringTokenizer(br.readLine()) var a = st.nextToken().toInt() var b = st.nextToken().toInt() if (a == 0 && b == 0) { break } else { bw.write("${a+b}\n") } } bw.flush() bw.close() br.close() } c..