[백준 16394] 홍익대학교 (C#, C++) - soo:bak
작성일 :
문제 링크
설명
주어진 연도가 홍익대학교 개교 몇 주년인지 구하는 문제입니다.
홍익대학교는 1946년에 개교했으므로, 연도 N이 주어지면 N - 1946이 개교 주년입니다.
접근법
입력받은 연도에서 1946을 빼서 출력합니다.
Code
C#
1
2
3
4
5
6
7
8
9
10
using System;
namespace Solution {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine()!);
Console.WriteLine(n - 1946);
}
}
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
cout << n - 1946 << "\n";
return 0;
}