Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 30 | 31 |
Tags
- Python
- sparse_table
- Prefix-Sum
- stack
- DP
- bitmask
- 백준
- BFS
- sliding-window
- kmp
- string
- bruteforcing
- C
- Binary-Search
- ad_hoc
- lazy-propagation
- math
- C++
- codeup
- Greedy
- PS
- knapsack
- lca
- number_theory
- implementation
- java
- backtracking
- queue
- Sort
- segment-tree
Archives
- Today
- Total
공작소
[ BOJ ] 1000 : A+B ( BRONZE 5 ) / C, C++, Python, Java 본문
문제
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
입력
첫째 줄에 A와 B가 주어진다. (0 < A, B < 10)
출력
첫째 줄에 A+B를 출력한다.
풀이 과정
BOJ의 가장 첫 번째 문제이자, 정수 두 개를 입력받고 합을 출력하는 문제이다.
언어의 입출력 규정에 맞게 코드를 작성하자.
C
#include <stdio.h>
int main(void) {
int a, b;
scanf("%d %d", &a, &b);
printf("%d", a+b);
return 0;
}
C++
#include <iostream>
using namespace std;
int main(void) {
int a, b; cin >> a >> b;
cout << a + b;
return 0;
}
Python
a, b = map(int, input().split())
print(a+b)
Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a+b);
}
}
'(예전 글) > PS' 카테고리의 다른 글
[ BOJ ] 10282 : 해킹 ( GOLD 4 ) / Python (0) | 2023.05.31 |
---|---|
[ BOJ ] 1001 : A-B ( BRONZE 5 ) / C, C++, Python, Java (1) | 2023.05.31 |
[ BOJ ] 14495 : 피보나치 비스무리한 수열 ( SILVER 5 ) / Python (0) | 2023.05.30 |
[ BOJ ] 2557 : Hello World ( BRONZE 5 ) / C, C++, Python, Java (0) | 2023.05.29 |
[ BOJ ] 21039 : Flip and Combos ( DIAMOND 5 ) / C (0) | 2023.05.29 |