Codeforces Round #260 (Div. 2)B. Fedya and Maths
2014-08-10 11:04
573 查看
Fedya and Maths
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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).
Input
The single line contains a single integer n (0 ≤ n ≤ 10105).
The number doesn't contain any leading zeroes.
Output
Print the value of the expression without leading zeros.
Sample test(s)
input
output
input
output
Note
Operation x mod y means taking remainder after division x by y.
Note to the first sample:
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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).
Input
The single line contains a single integer n (0 ≤ n ≤ 10105).
The number doesn't contain any leading zeroes.
Output
Print the value of the expression without leading zeros.
Sample test(s)
input
4
output
4
input
124356983594583453458888889
output
0
题意:我是找规律得到的
#include <stdio.h> int x; int main() {scanf("%d",&x); putchar(x%4?48:52); return 0; }
这是大神的代码
Note
Operation x mod y means taking remainder after division x by y.
Note to the first sample:
![](http://espresso.codeforces.com/825f244180bb10323db01645118c3cfdb312fa89.png)
相关文章推荐
- Codeforces Round #260 (Div. 2) B. Fedya and Maths
- Codeforces Round #260 (Div. 2)B. Fedya and Maths
- Codeforces Round #260 (Div. 2) B. Fedya and Maths
- Codeforces Round #260 (Div. 2) B. Fedya and Maths(循环结)
- codeforces #260 B. Fedya and Maths(水)
- Codeforces Round #260 (Div. 2) A , B , C 标记,找规律 , dp
- Codeforces Round #312 (Div. 2)——C暴力技巧——Amr and Chemistry
- 【Codeforces Round 299 (Div 2)D】【KMP 本质是最前与最后匹配】Tavas and Malekas 长度为n的匹配串被模板串多位点覆盖的匹配串个数
- Codeforces Round #261 (Div. 2) D. Pashmak and Parmida's problem
- Codeforces Round #174 (Div. 2) Cows and Sequence(线段树)
- Codeforces Round #341 (Div. 2) E. Wet Shark and Blocks(矩阵优化DP)
- Codeforces Round #321 (Div. 2) Kefa and First Steps 模拟
- Codeforces Round #257 (Div. 2) B Jzzhu and Sequences
- Codeforces Round #252(Div. 2) 441C. Valera and Tubes 构造
- 【Codeforces Round 330 (Div 2)E】【贪心 暴力】Edo and Magnets 给定矩形最多去除m个,最小面积矩形使得覆盖所有小矩形重心
- codeforces Round 447 div2 D Ralph And His Tour in Binary Country
- Codeforces Round #379 (Div. 2) F. Anton and School
- Codeforces Round #260 (Div. 1) --B. A Lot of Games (Trie)
- Codeforces 584 B. Kolya and Tanya (Codeforces Round #324 (Div. 2))
- Codeforces Round #228 (Div. 2)B. Fox and Cross