[백준 18108] 1998년생인 내가 태국에서는 2541년생?! (C#, C++) - soo:bak
작성일 :
문제 링크
18108번 - 1998년생인 내가 태국에서는 2541년생?!
설명
불기 연도가 주어지면 서기 연도로 바꾸기 위해 543을 뺍니다.
접근법
입력된 연도에서 543을 빼 바로 출력합니다.
Code
C#
1
2
3
4
5
6
7
8
using System;
class Program {
static void Main() {
var year = int.Parse(Console.ReadLine()!);
Console.WriteLine(year - 543);
}
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int year; cin >> year;
cout << year - 543 << "\n";
return 0;
}