Notice
Recent Posts
Recent Comments
Link
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

main

[백준-15552번/Java] 빠른 A+B 본문

Algorithm

[백준-15552번/Java] 빠른 A+B

1984 2022. 11. 10. 16:55

* BufferedWriter.flush는 맨 마지막에 한 번만 하면 된다.

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main {

	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

			int N = Integer.parseInt(br.readLine());
			for (int i = 0; i < N; i++) {
				String str = br.readLine();
				int num1 = Integer.parseInt(str.split(" ")[0]);
				int num2 = Integer.parseInt(str.split(" ")[1]);
				
				bw.write(num1 + num2 + "\n");
			}

			bw.flush();
			bw.close();
		} catch (IOException e) {
			// IOExeception
		}

	}

}
728x90

'Algorithm' 카테고리의 다른 글

[백준-8959번/Java] OX 퀴즈  (0) 2022.11.10
[백준-3052번/Java] 나머지  (0) 2022.11.10
[백준-10757번/Java] 큰 수 A + B  (0) 2022.11.10
[백준-2292번/Java] 벌집  (0) 2022.11.10
[백준-1712번/Java] 손익분기점  (0) 2022.11.10
Comments