Hongik University
InterviewTime limit1sMemory limit256 MB
Read a year N and print how many years have passed since 1946, so output N minus 1946.
- Level
Easy1 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Hongik University was founded in 1946.
Given a particular year, print how many years have passed since the university was founded.
Assume that Hongik University is never closed.
Solve the problem in C, C++, JAVA, or Python3.
-
C
-
Input
- Use scanf
- Use %d for integers, %f for floating-point numbers, %s for strings
- scanf("%d", &var);
-
Output
- Use %d for integers, %f for floating-point numbers, %s for strings
- Example: printf("%d", var);
-
Required library: stdio.h
-
-
C++
-
Input
- Use cin
- Example: cin >> var;
-
Output
- Use cout
- Example: cout << var;
-
Required library: iostream
-
Recommendations
- using namespace std;
- ios::sync_with_stdio(false);
- cin.tie(NULL);
-
-
Java
-
Input
- Use Scanner
- Scanner sc = new Scanner(System.in); Integer: sc.nextInt(); Float: sc.nextDouble(); String: sc.nextLine(); or sc.next();
-
Output
- System.out.println(var);
-
Required library: java.util.Scanner
-
Input
The first line of input gives an integer N, a particular year. N is between 1,946 and 1,000,000. (1,946 ≤ N ≤ 1,000,000)
Output
Print an integer representing the anniversary of Hongik University's founding.