[백준] 7891

당당·2023년 5월 28일
0

백준

목록 보기
135/179

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 (−10^9 ≤ x, y ≤ 10^9).


📺출력

For each test case output output the sum of the corresponding integers.


📝예제 입력 1

4
-100 100
2 3
0 110101
-1000000000 1

📺예제 출력 1

0
5
110101
-999999999

🔍출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2008 PA번


🧮알고리즘 분류

  • 수학
  • 구현
  • 사칙연산

📃소스 코드

import java.util.Scanner;

public class Code7891 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++){
            int x=sc.nextInt();
            int y=sc.nextInt();

            System.out.println(x+y);
        }
    }
}

📰출력 결과


📂고찰

add였기 때문에 int범위를 안넘어가서 int로 선언해서 더했다.

profile
MySQL DBA 신입 지원

0개의 댓글