http://codeforces.com/contest/456/problem/B

CF#260 div2 B Fedya and Maths

Codeforces Round #260

B. 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 + 4nmod 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
Note

Operation x mod y means taking remainder after division x by y.

Note to the first sample:

题解:

打表找规律,发现输入是4的倍数就出4,否则出0。

而4的倍数只用看最后两位,怕了。

 //#pragma comment(linker, "/STACK:102400000,102400000")
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
using namespace std;
#define ll long long
#define usint unsigned int
#define mz(array) memset(array, 0, sizeof(array))
#define minf(array) memset(array, 0x3f, sizeof(array))
#define REP(i,n) for(i=0;i<(n);i++)
#define FOR(i,x,n) for(i=(x);i<=(n);i++)
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define WN(x) printf("%d\n",x);
#define RE freopen("D.in","r",stdin)
#define WE freopen("1biao.out","w",stdout) int main() {
//RE;
ll n=;
char c,prec,preprec;
while(scanf("%c",&c)!=EOF && c>='' && c<='') {
preprec=prec;
prec=c;
n++;
}
//printf("%c,%c,%c\n",c,prec,preprec);
ll t;
if(n>) t=(preprec-'')*+(prec-'');
else t=prec-'';
if(t%==)puts("");
else puts("");
return ;
}

CF456B Fedya and Maths 找规律的更多相关文章

  1. Codeforces 456B Fedya and Maths 打表找规律

    Description Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expre ...

  2. Codeforces Round #260 (Div. 2) A B C 水 找规律(大数对小数取模) dp

    A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  3. URAL 1780 G - Gray Code 找规律

    G - Gray CodeTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view ...

  4. Codeforces Round #260 (Div. 2) A , B , C 标记,找规律 , dp

    A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  5. HDU 4349 Xiao Ming's Hope 找规律

    原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4349 Xiao Ming's Hope Time Limit: 2000/1000 MS (Java/ ...

  6. hdu 3951 - Coin Game(找规律)

    这道题是有规律的博弈题目,,, 所以我们只需要找出规律来就ok了 牛人用sg函数暴力找规律,菜鸟手工模拟以求规律...[牢骚] if(m>=2) { if(n<=m) {first第一口就 ...

  7. HDU 5703 Desert 水题 找规律

    已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...

  8. hdu4952 Number Transformation (找规律)

    2014多校 第八题 1008 2014 Multi-University Training Contest 8 4952 Number Transformation Number Transform ...

  9. hdu 4731 2013成都赛区网络赛 找规律

    题意:找字串中最长回文串的最小值的串 m=2的时候暴力打表找规律,打表可以用二进制枚举

随机推荐

  1. 【BZOJ-4456】旅行者 分治 + 最短路

    4456: [Zjoi2016]旅行者 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 254  Solved: 162[Submit][Status] ...

  2. 控件的invoke和beginInvoke方法

    System.Windows.Forms.Timer 的timer是在主线程上执行的,因此在timer的tick事件中操作界面上的控件不会发生线程的安全性检测. Control的invoke和begi ...

  3. SQL查询排序某字段并选前N条数据

    看了网上各种乱七八糟的答案,无语. 明明这一句话就行了. select * from personinfo order by credit DESC limit 0,5

  4. 【Beta版本】冲刺计划及安排

    目录 一.Beta的初步完善 二.团队分工的改进 三.工具流程的改进 四.冲刺阶段的计划与安排 五.关于组长是否重选 六.附录 队伍:606notconnected 成员:031401433 张斯巍  ...

  5. iOS - NSError用法规范

    iphone跬步之--错误信息 NSError   一.获取系统的错误信息 比如移动文件时,获取文件操作错误: NSError *e = nil;[[NSFileManager defaultMana ...

  6. vmware下linux系统的安装过程

    虚拟机VMware下CentOS6.6安装教程图文详解 [日期:2016-05-24] 来源:Linux社区  作者:Sungeek [字体:大 中 小]   分享下,虚拟机VMware下CentOS ...

  7. uC/OS-II时间(OS_time)块

    /*************************************************************************************************** ...

  8. C#获取C++中修改过的float数组(指针),dll

    C++中 struct rankPoint{ float sim; }; ]){ ; i < ; i++) prank[i].sim = ; ; i < ; i++) prank[i].s ...

  9. 使用angularjs定义html中的属性ng-attr-(suffix)

    html中的属性很多,同样可以使用angularjs来定义: ng-attr-(suffix)=只能使用变量定义 <div title="angularjs中的title"& ...

  10. 使用MVC过滤器保存操作日志

    //定义过滤器 public class  LogAttribute : ActionFilterAttribute { /// <summary> /// 以逗号间隔 /// </ ...