반응형
문제
https://www.acmicpc.net/problem/1001
1001번: A-B
두 정수 A와 B를 입력받은 다음, A-B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
풀이
- 1000번과 동일하고 연산자만 바꿔주면 풀이할 수 있음
- https://www.acmicpc.net/problem/1000
1000번: A+B
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
소스코드
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
let input = readLine()!.split(separator: " ").map { Int($0)! } | |
let a = input[0], b = input[1] | |
print(a - b) |
후기
- 단순하게 입력을 받아서 a-b 값을 출력해주는 문제
반응형
'PS > 백준' 카테고리의 다른 글
[BOJ] 백준 1008 A/B (Swift) (0) | 2022.11.27 |
---|---|
[BOJ] 백준 10998 AxB (Swift) (0) | 2022.11.27 |
[BOJ] 백준 1000 A+B (Swift) (0) | 2022.11.27 |
[BOJ] 백준 2557 Hello World (Swift) (0) | 2022.11.27 |
[BOJ] 백준 2036 수열의 점수 (Swift) (0) | 2022.11.19 |