Post

[BOJ 10950] A+B - 3

Baekjoon Online Judge 10950(Java 11)
[A+B - 3] 문제 풀이

[BOJ 10950] A+B - 3

-> 문제 바로가기



시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초256 MB37631322080818354458.648%

문제


  • 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.


입력


  • 첫째 줄에 테스트 케이스의 개수 T가 주어진다.
  • 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)


출력


  • 각 테스트 케이스마다 A+B를 출력한다.


예제


1
2
3
4
5
6
7
// 입력
5
1 1
2 3
3 4
9 8
5 2
1
2
3
4
5
6
// 출력
2
5
7
17
7


출처



비슷한 문제



알고리즘 분류








제출



내 제출


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
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void solution() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        
        int num = Integer.parseInt(br.readLine());

        for (int i = 1; i <= num; i++) {
            StringTokenizer st = new StringTokenizer(br.readLine(), " ");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());

            bw.write(String.valueOf(a + b) + "\n");
        }

        bw.flush();
        bw.close();
        br.close();
    }

    public static void main(String[] args) throws IOException {
        solution();
    }
}


런타임메모리
108 ms14292 KB


Reference


This post is licensed under CC BY 4.0 by the author.