题目描述:
Fedya studies in a gymnasium. Fedya’s maths hometask is to calculate the following expression:
(1n + 2n + 3n + 4n) mod 5
for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
输入描述:
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn’t contain any leading zeroes.
输出描述:
Print the value of the expression without leading zeros.
输入:
4
124356983594583453458888889
输出:
4
0
题意:
给出(1^ n+2^ n+3^ n+4^n)模5的余数。
题解:
n | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
1 | 1 | 1 | 1 | 1 |