python_algorithm_basic python 백준 solved

[Python/파이썬] 백준 7891번 - Can you add this?

Kwangjin Park

Sep 05, 2024 · 1 min read

Follow

문제

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.

풀이

  • 입력받는 횟수 n번 만큼 for 반복문을 돌리며,
  • 두 정수를 입력 받아 그 합을 출력한다.

코드

n = int(input())

for i in range (1, n+1):
    a, b = map(int, input().split())
    print(a+b)



chat_bubble 0

chat_bubble 댓글남기기

댓글남기기