[BOJ 10952] A+B - 5
Baekjoon Online Judge 10952(Java 11)
[A+B - 5] 문제 풀이
[BOJ 10952] A+B - 5
시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 256 MB | 354086 | 188000 | 159754 | 52.786% |
문제
- 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
입력
- 입력은 여러 개의 테스트 케이스로 이루어져 있다.
- 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)
- 입력의 마지막에는 0 두 개가 들어온다.
출력
- 각 테스트 케이스마다 A+B를 출력한다.
예제
1
2
3
4
5
6
7
// 입력
1 1
2 3
3 4
9 8
5 2
0 0
1
2
3
4
5
6
// 출력
2
5
7
17
7
출처
비슷한 문제
- 1000번. A+B
- 1001번. A-B
- 1008번. A/B
- 2558번. A+B - 2
- 10950번. A+B - 3
- 10951번. A+B - 4
- 10953번. A+B - 6
- 10998번. A×B
- 11021번. A+B - 7
- 11022번. A+B - 8
- 15740번. A+B - 9
- 15792번. A/B - 2
알고리즘 분류
제출
내 제출
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
import java.io.*;
import java.util.*;
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));
while (true) {
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
if (a == 0 && b == 0) {
break;
}
bw.write(String.valueOf(a + b) + "\n");
}
bw.flush();
bw.close();
br.close();
}
public static void main(String[] args) throws IOException {
solution();
}
}
런타임 | 메모리 |
---|---|
112 ms | 14368 KB |
Reference
This post is licensed under CC BY 4.0 by the author.