World Cup
作者:互联网
Problem Statement
A sport event is held in June of every year whose remainder when divided by $4$ is $2$.
Suppose that it is now January of the year $Y$. In what year will this sport event be held next time?
Constraints
- $2000 \leq Y \leq 3000$
- $Y$ is an integer.
Input
Input is given from Standard Input in the following format:
$Y$
Output
Print the answer.
Sample Input 1
2022
Sample Output 1
2022
The remainder when $2022$ is divided by $4$ is $2$, so if it is now January of $2022$, the next games will be held in June of the same year.
Sample Input 2
2023
Sample Output 2
2026
Sample Input 3
3000
Sample Output 3
3002
模拟即可。
#include<cstdio>
int y;
int main()
{
scanf("%d",&y);
if(y%4==3)
printf("%d",y+3);
else
printf("%d",y+(2-y%4));
}
标签:Cup,Sample,held,Output,12022,year,World,Input 来源: https://www.cnblogs.com/mekoszc/p/16684497.html