문제 링크: https://www.acmicpc.net/problem/1001
백준 입출력과 사칙연산 3단계 - 1001번 A-B를 풀어보았다.
풀이: 정수 두 개를 입력받고, 차를 출력한다.
C++
#include <iostream>
using namespace std;
int main() {
int first, second;
cin >> first >> second;
cout << first-second;
}
Python
a,b=map(int,input().split())
print(a-b)
Java
import java.util.Scanner;
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);
}
}
'코테용 문제풀이 > 백준' 카테고리의 다른 글
A/B 풀이 (0) | 2022.12.30 |
---|---|
A×B 풀이 (0) | 2022.12.30 |
A+B 풀이 (0) | 2022.12.30 |
Hello World 풀이 (0) | 2022.12.30 |
X보다 작은 수 풀이 (0) | 2022.12.30 |