![[백준 / BOJ] 18108번 1998년생인 내가 태국에서는 2541년생?! (C++, Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcjfoUy%2FbtrLg8SO3BX%2FOdmIsRx4PiqKjXSt2Ld3T0%2Fimg.jpg)
[백준 / BOJ] 18108번 1998년생인 내가 태국에서는 2541년생?! (C++, Python)◎ 자료구조와 알고리즘/백준(BOJ) 문제풀이2022. 9. 2. 18:25
반응형
링크 : https://www.acmicpc.net/problem/18108
18108번: 1998년생인 내가 태국에서는 2541년생?!
ICPC Bangkok Regional에 참가하기 위해 수완나품 국제공항에 막 도착한 팀 레드시프트 일행은 눈을 믿을 수 없었다. 공항의 대형 스크린에 올해가 2562년이라고 적혀 있던 것이었다. 불교 국가인 태국
www.acmicpc.net
문제

문제 풀이
간단한 사칙연산 문제다. 예제 문제에서 입력받은 값에서 -543을 하면 된다는 것을 알 수 있다.
코드 전문
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; | |
std::cin >> var; | |
std::cout << var - 543 << "\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__": | |
print(int(input()) - 543) |
소감
반응형
'◎ 자료구조와 알고리즘 > 백준(BOJ) 문제풀이' 카테고리의 다른 글
[백준 / BOJ] 10430번 나머지 (C++, Python) (0) | 2022.09.04 |
---|---|
[백준 / BOJ] 3003번 킹, 퀸, 룩, 비숍, 나이트, 폰 (C++, Python) (0) | 2022.09.03 |
[백준 / BOJ] 10926번 ??! (C++, Python) (0) | 2022.09.01 |
[백준 / BOJ] 10869번 사칙연산 (C++, Python) (0) | 2022.09.01 |
[백준 / BOJ] 1008번 A/B (C++, Python) (1) | 2022.09.01 |
@Reo :: 코드 아카이브
자기계발 블로그