Official

A - World Cup Editorial by en_translator


If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.
Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in “AtCoder Beginners Selection” (https://atcoder.jp/contests/abs).
「競プロ典型 90 問」(Typical 90 Problems of Competitive Programming) (https://atcoder.jp/contests/typical90) is a collection of typical 90 competitive programming problems; unfortunately, currently the problem statements are all Japanese.
「C++入門 AtCoder Programming Guide for beginners (APG4b)」(https://atcoder.jp/contests/APG4b) is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.


the answer is \(2\) years later if the remainder when \(Y\) is divided by \(4\) equals \(0\); \(1\) year later if \(1\); the same year if \(2\); \(3\) years later if \(3\).
In most programming languages like C++, the remainder when dividing \(Y\) by \(4\) can be found by:

Y%4

Use this syntax, implement conditional branches using if statements etc., and print the answer according to the case division above, then your code will be accepted.

Sample code (C++)

#include <bits/stdc++.h>
using namespace std;

int main() {
    
	int Y;
	cin>>Y;
	
	if(Y%4==0)cout<<Y+2<<endl;
	if(Y%4==1)cout<<Y+1<<endl;
	if(Y%4==2)cout<<Y<<endl;
	if(Y%4==3)cout<<Y+3<<endl;
	
	return 0;
}

posted:
last update: