Codeforces Round #260 (Div. 2) B
Description
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
- 4
- 124356983594583453458888889
- 0
Operation x mod y means taking remainder after division x by y.
Note to the first sample:
题意:看题目中的公式
解法:打表找规律
- #include<bits/stdc++.h>
- using namespace std;
- class P
- {
- public:
- int n,m;
- };
- bool cmd(P x,P y)
- {
- return x.n<y.n;
- }
- int main()
- {
- long long ans=0;
- string s;
- cin>>s;
- if(s.length()==1)
- {
- ans+=s[s.length()-1]-'0';
- }
- else
- {
- ans+=((s[s.length()-2]-'0')*10+s[s.length()-1]-'0');
- }
- // cout<<ans<<endl;
- if(ans%4)
- {
- cout<<"0"<<endl;
- }
- else
- {
- cout<<"4"<<endl;
- }
- return 0;
- }
Codeforces Round #260 (Div. 2) B的更多相关文章
- DP Codeforces Round #260 (Div. 1) A. Boredom
题目传送门 /* 题意:选择a[k]然后a[k]-1和a[k]+1的全部删除,得到点数a[k],问最大点数 DP:状态转移方程:dp[i] = max (dp[i-1], dp[i-2] + (ll) ...
- 递推DP Codeforces Round #260 (Div. 1) A. Boredom
题目传送门 /* DP:从1到最大值,dp[i][1/0] 选或不选,递推更新最大值 */ #include <cstdio> #include <algorithm> #in ...
- Codeforces Round #260 (Div. 2)AB
http://codeforces.com/contest/456/problem/A A. Laptops time limit per test 1 second memory limit per ...
- Codeforces Round #260 (Div. 1) D. Serega and Fun 分块
D. Serega and Fun Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/pro ...
- Codeforces Round #260 (Div. 1) C. Civilization 并查集,直径
C. Civilization Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/probl ...
- Codeforces Round #260 (Div. 1) A - Boredom DP
A. Boredom Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/problem/A ...
- Codeforces Round #260 (Div. 1) A. Boredom (简单dp)
题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. ...
- Codeforces Round #260 (Div. 1) 455 A. Boredom (DP)
题目链接:http://codeforces.com/problemset/problem/455/A A. Boredom time limit per test 1 second memory l ...
- Codeforces Round #260 (Div. 2)
A. Laptops 题目意思: 给定n台电脑,第i台电脑的价格是ai ,质量是bi ,问是否存在一台电脑价格比某台电脑价格底,但质量确比某台电脑的质量高,即是否存在ai < aj 且 bi & ...
- Codeforces Round #260 (Div. 2) C
Description Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. On ...
随机推荐
- webDriver中的alert
driver.switchTo().alert();这句可以得到alert\confirm\prompt对话框的对象,然后运用其方法对它进行操作.对话框操作的主要方法有: getText() ...
- drop,delete,truncate区别
drop,delete,truncate区别 drop-->删除少量信息 eg:drop table 表名: delete-->删除某些数据 eg:delete from 表名: ...
- ls -l 列表信息详解
我们平时用ls -l 命令查看一个目录下的文件和子目录的详悉信息时,会得到一个详细的文件和目录名列表.这个列表包含了文件的属性,所属用户,所属组,创建时间,文件大小等等信息.这些信息到底是什么意思呢? ...
- Android中实现消息推送(JPush)
1,去JPush官网注册一个账号,创建你的app的应用,并且拿到你应用的AppKey 2,在JPush官网下载对应的sdk,解压出来,将libs文件下的所有的文件全部复制到你工程的libs文件中 3, ...
- Android 发送短信与接收短信
package com.example.testsms; import android.app.Activity; import android.app.PendingIntent; import a ...
- ORACLE 默认密码确认
select USER_NAME USER_WITH_DEFAULT_PASSWORD from ( select fnd_web_sec.validate_login('AME_INVALID_AP ...
- zw版【转发·台湾nvp系列Delphi例程】HALCON AffineTransRegion
zw版[转发·台湾nvp系列Delphi例程]HALCON AffineTransRegion unit Unit1;interfaceuses Windows, Messages, SysUtils ...
- HGE游戏引擎之实战篇,渐变的游戏开场
#include <hge.h> #include "menuitem.h" //#include <hgefont.h> #include <hge ...
- Intel+Ardruino 101
为了传说中的那啥, 啊, 嗯.. #include <CurieBLE.h>const int ledPin = 13; // set ledPin to on-board LED LE ...
- 9、Http回顾/Servlet
1 Http回顾 Http协议: 1)http协议: 对浏览器客户端和服务器端之间数据传输的格式规范. 2)http请求:浏览器->服务器端 格式: 请求行(请求方式(GET/POST) 请求资 ...