Educational Codeforces Round 8 B. New Skateboard
题目链接:http://codeforces.com/problemset/problem/628/B
解题思路:
一个数最后两位数能被4整除那么这个数就能被4整除,而且题目还是连续的子序列,这就很简单了
实现代码:
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <bitset>
using namespace std;
#define ll long long
int main()
{
ll ans = ,i,j,num,k;
string s;
cin>>s;
int len = s.size();
for(i=;i<len;i++){
num = s[i]-'';
if(num%==)
ans++;
}
//cout<<ans<<endl;
if(len>=){
for(i=;i<len-;i++){
num = (s[i] - '')*+(s[i+]-'');
if(num%==)
ans++;
}
}
//cout<<ans<<endl;
if(len>=){
for(i=;i<len-;i++){
num = (s[i] - '')*+(s[i+]-'');
if(num%==){
ans+=i;
}
//cout<<ans<<endl;
}
}
cout<<ans<<endl;
}
Educational Codeforces Round 8 B. New Skateboard的更多相关文章
- Educational Codeforces Round 8 B. New Skateboard 暴力
B. New Skateboard 题目连接: http://www.codeforces.com/contest/628/problem/A Description Max wants to buy ...
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
- [Educational Codeforces Round 16]C. Magic Odd Square
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...
- [Educational Codeforces Round 16]B. Optimal Point on a Line
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...
- [Educational Codeforces Round 16]A. King Moves
[Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...
- Educational Codeforces Round 6 C. Pearls in a Row
Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...
- Educational Codeforces Round 9
Educational Codeforces Round 9 Longest Subsequence 题目描述:给出一个序列,从中抽出若干个数,使它们的公倍数小于等于\(m\),问最多能抽出多少个数, ...
- Educational Codeforces Round 37
Educational Codeforces Round 37 这场有点炸,题目比较水,但只做了3题QAQ.还是实力不够啊! 写下题解算了--(写的比较粗糙,细节或者bug可以私聊2333) A. W ...
随机推荐
- 学习Android(入门基础和实用教程)
为了方便大家学习,准备录制Android基础篇的视频教程, https://item.taobao.com/item.htm?spm=0.7095261.0.0.17a61debAKIDPI& ...
- python伪代码之爬取完美志愿全国历年文理分数线运行代码持续更新
最近好多小伙伴说想搞个项目实战类的,我就花了一点时间做了一个爬虫项目(在代码复制的时候可能会有点问题,缩格一下就没有问题了) 想要获取更多源码或者答疑或者或者交流学习可以加群:725479218 # ...
- xml文件里 用js语句获取 当前时间
获取当前时间的代码:xml文件中 <td><div align="center"><br/><strong>送检时间</str ...
- ASP.NET Core StaticFiles中间件修改wwwroot(转载)
ASP.NET Core 开发,中间件(StaticFiles)的使用,我们开发一款简易的静态文件服务器.告别需要使用文件,又需要安装一个web服务器.现在随时随地打开程序即可使用,跨平台,方便快捷. ...
- EZ 2018 06 10 NOIP2018 模拟赛(十八)
好久没写blog&&比赛题解了,最近补一下 这次还是很狗的,T3想了很久最后竟然连并查集都忘写了,然后T2map莫名爆炸. Rating爆减......链接不解释 好了我们开始看题. ...
- Centos7下关于系统用户密码规则-运维笔记
针对Centos7下的系统用户的密码规则复杂度的设置,处于安全考虑,说明如下: 一.设置密码规则 1)密码长度.有效期 /etc/login.defs文件是当创建用户时的一些规划,比如创建用户时,是否 ...
- Mongodb副本集+分片集群环境部署记录
前面详细介绍了mongodb的副本集和分片的原理,这里就不赘述了.下面记录Mongodb副本集+分片集群环境部署过程: MongoDB Sharding Cluster,需要三种角色: Shard S ...
- 牛客多校第二场A run(基础DP)
链接:https://www.nowcoder.com/acm/contest/140/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言2621 ...
- LINUX内核分析第六周学习总结——进程的描述与创建
LINUX内核分析第六周学习总结--进程的描述与创建 标签(空格分隔): 20135321余佳源 余佳源 原创作品转载请注明出处 <Linux内核分析>MOOC课程 http://mooc ...
- Struts2中的图片验证码
1.Struts中建一个action <action name="Code" class="LoginAction" method="code& ...