Official
A - 技術室奥プログラミングコンテストの未来 Editorial
by
A - 技術室奥プログラミングコンテストの未来 Editorial
by
shiomusubi496
if 文により場合分けをすることで解くことができます。 \(2017\) 年に技術室奥コンテストが開催されていないことに気を付けてください。
実装例 (C++)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N;
if(N <= 2014 || N == 2017) cout << -1 << endl;
else if(N <= 2016) cout << N-2014 << endl;
else cout << N-2015 << endl;
}
実装例 (Python)
N = int(input())
if N <= 2014 or N == 2017:
print(-1)
elif N <= 2016:
print(N-2014)
else:
print(N-2015)
posted:
last update: