[백준 / BOJ] 10950번 A+B - 3 (C++, Python)◎ 자료구조와 알고리즘/백준(BOJ) 문제풀이2021. 8. 22. 22:23
반응형
링크 : https://www.acmicpc.net/problem/10950
10950번: A+B - 3
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
문제

문제 풀이
덧셈 문제다!
코드 전문
C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
void init() { | |
std::ios_base::sync_with_stdio(false); | |
std::cin.tie(nullptr); | |
std::cout.tie(nullptr); | |
} | |
int main() { | |
init(); | |
int var, a, b; | |
std::cin >> var; | |
for (int i = 0; i < var; ++i) { | |
std::cin >> a >> b; | |
std::cout << a + b << "\n"; | |
} | |
return 0; | |
} |
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
input = sys.stdin.readline | |
if __name__ == "__main__": | |
var = int(input()) | |
for i in range(var): | |
x, y = map(int, input().split()) | |
print(x + y) |
소감
반응형
'◎ 자료구조와 알고리즘 > 백준(BOJ) 문제풀이' 카테고리의 다른 글
[백준 / BOJ] 15552번 빠른 A+B (C++, Python) (0) | 2021.08.22 |
---|---|
[백준 / BOJ] 8393번 합 (C++, Python) (0) | 2021.08.22 |
[백준 / BOJ] 2739번 구구단 (C++, Python) (0) | 2021.08.22 |
[백준 / BOJ] 2884번 알람 시계 (C++, Python) (0) | 2021.08.22 |
[백준 / BOJ] 14681번 사분면 고르기 (C++, Python) (0) | 2021.08.22 |
@Reo :: 코드 아카이브
자기계발 블로그