반응형
SMALL
문제 정보
문제명 - Can you add this?
난이도 - 브론즈 V
문제 번호 - 7891번
문제 링크
https://www.acmicpc.net/problem/7891
문제
Given two integers, calculate and output their sum.
입력
The input contains several test cases. The first line contains and integer t (t ≤ 100) denoting the number of test cases. Then t tests follow, each of them consisiting of two space separated integers x and y (−109 ≤ x, y ≤ 109).
출력
For each test case output output the sum of the corresponding integers.
예제 입력/출력
예제 입력 예제 출력 4 -100 100 2 3 0 110101 -1000000000 1
0 5 110101 -999999999
알고리즘 분류
● 수학
● 구현
● 사칙연산
소스코드
package Lv1_Bronze;
import java.io.*;
import java.util.*;
/**
* @author HanHoon
* @category 수학, 구현, 사칙연산
* https://www.acmicpc.net/problem/7891
*/
public class BOJ_B5_7891_Can_you_add_this {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = null;
StringBuilder str = new StringBuilder();
// N
int N = Integer.parseInt(br.readLine());
for (int n = 0; n < N; n++){
st = new StringTokenizer(br.readLine());
str.append(Integer.parseInt(st.nextToken()) + Integer.parseInt(st.nextToken())).append("\n");
}
System.out.print(str);
br.close();
}
}
BaekJoon List
기회는 준비된 자에게 찾아온다.
반응형
LIST
'BaekJoon > Bronze' 카테고리의 다른 글
[BOJ/JAVA] 백준 5300 : Fill the Rowboats (자바) (0) | 2023.10.21 |
---|---|
[BOJ/JAVA] 백준 1718 : 암호 (자바) (2) | 2023.10.20 |
[BOJ/JAVA] 백준 1681 : 줄 세우기 (자바) (0) | 2023.10.17 |
[BOJ/JAVA] 백준 1453 : 피시방 알바 (자바) (0) | 2023.08.23 |
[BOJ/JAVA] 백준 1440 : 타임머신 (자바) (0) | 2023.08.22 |
댓글