Codeforces 456B Fedya and Maths
来源:互联网 发布:网络电影榜单 编辑:程序博客网 时间:2024/06/04 19:04
题目链接:http://codeforces.com/problemset/problem/456/B
B. Fedya and Maths
time limit per test
1 secondmemory limit per test
256 megabytesinput
standard inputoutput
standard outputFedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:
for given value of n. Fedya managed to complete the task. Can you? Note that given numbern 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
Note
Operation x mod y means taking remainder after divisionx by y.
Note to the first sample:
循环节为4,所以只要判断n是否能整除4.又有一个数能被4整除当且仅当后两位能被4整除。所以直接取后两位进行判断即可。
代码:
#include<stdio.h>#include<string.h>const int maxn=100005;char s[maxn];int main(){ while(scanf("%s",s)!=EOF) { int len=strlen(s); int a=s[len-1]-'0'; int b=s[len-2]-'0'; int c=a+b*10; if(c%4==0) printf("4\n"); else printf("0\n"); } return 0;}
0 0
- Codeforces 456B Fedya and Maths
- Codeforces 456B Fedya and Maths(数学)
- B. Fedya and Maths
- cf 456B - 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) B Fedya and Maths
- Codeforces Round #260 (Div. 2) B. Fedya and Maths
- Codeforces #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 456B. Fedya and Maths(大数取模/大数的幂)
- CF 456B(Fedya and Maths-找循环节)
- codeforce 2014808 B. Fedya and Maths
- CF 260 B. Fedya and Maths
- Codeforces Round #260 (Div. 2) B. Fedya and Maths【超数范围的取模】
- 链表讲解和基本操作练习附代码
- 关于多层for循环迭代的效率优化问题
- epoll实例
- 【Swift培训】苹果官方Swift教程-语法结构(中文)
- 素数判断----E -Fermat’s Chirstmas Theorem
- Codeforces 456B Fedya and Maths
- Mac系统知识简介
- NDK编译错误Unknown Application ABI,Unable to detect application ABI’s
- JAVA浮点数保留位数
- 深圳市解放路网络科技有限公司
- 简学LINGO(三)——实例篇
- 什么事垂直网站和垂直收索
- C++中的前置声明(Forward Declaration)
- 删除svn的.svn文件