题目链接: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的更多相关文章

  1. Educational Codeforces Round 8 B. New Skateboard 暴力

    B. New Skateboard 题目连接: http://www.codeforces.com/contest/628/problem/A Description Max wants to buy ...

  2. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  3. [Educational Codeforces Round 16]D. Two Arithmetic Progressions

    [Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...

  4. [Educational Codeforces Round 16]C. Magic Odd Square

    [Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...

  5. [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 ...

  6. [Educational Codeforces Round 16]A. King Moves

    [Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...

  7. Educational Codeforces Round 6 C. Pearls in a Row

    Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...

  8. Educational Codeforces Round 9

    Educational Codeforces Round 9 Longest Subsequence 题目描述:给出一个序列,从中抽出若干个数,使它们的公倍数小于等于\(m\),问最多能抽出多少个数, ...

  9. Educational Codeforces Round 37

    Educational Codeforces Round 37 这场有点炸,题目比较水,但只做了3题QAQ.还是实力不够啊! 写下题解算了--(写的比较粗糙,细节或者bug可以私聊2333) A. W ...

随机推荐

  1. day89

    跨域问题 同源策略(Same origin policy) 是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,则浏览器的正常功能可能都会受到影响.可以说Web是构建在同源策略基础之上 ...

  2. 不存在具有键“xxxId”的“IEnumerable<SelectListItem>”类型的 ViewData 项

    项目中的某个页面,在访问时出现以下错误: 不存在具有键“xxxId”的“IEnumerable<SelectListItem>”类型的 ViewData 项 具体的场景说明如下: 一个编辑 ...

  3. python 知识2

    零. type()函数怎么使用 type()的使用方法:type(对象)type()是接收一个对象当做参考,之后反回对象的相应类型.>>>type(1)<type 'int'& ...

  4. 使用yield返回IEnumber<T>集合

    yield是对一种复杂行为的简化,就是将一段代码简化为一种简单的形式. 先看一下常规的写法,下面例子中,把找出字符串阵列中,某些元素包含有某些字符的元素. class Bi { public stri ...

  5. springboot @Value 获取计算机中绝对路径文件的内容

    默认情况下使用 @Value("aaa.txt") private Resource txtResource; 这样获取到的是项目classpath 下的 aaa.txt 如果想获 ...

  6. 任务(task)

    任务概述 线程(Thread)是创建并发的底层工具,因此有一定的局限性(不易得到返回值(必须通过创建共享域):异常的捕获和处理也麻烦:同时线程执行完毕后无法再次开启该线程),这些局限性会降低性能同时影 ...

  7. 利用卷积神经网络(VGG19)实现火灾分类(附tensorflow代码及训练集)

    源码地址 https://github.com/stephen-v/tensorflow_vgg_classify 1. VGG介绍 1.1. VGG模型结构 1.2. VGG19架构 2. 用Ten ...

  8. 运维中的日志切割操作梳理(Logrotate/python/shell脚本实现)

    对于Linux系统安全来说,日志文件是极其重要的工具.不知为何,我发现很多运维同学的服务器上都运行着一些诸如每天切分Nginx日志之类的CRON脚本,大家似乎遗忘了Logrotate,争相发明自己的轮 ...

  9. C. Multi-Subject Competition

    链接 [https://codeforces.com/contest/1082/problem/C] 题意 有n个人,m个科目,每个人都有选的科目si,以及他的能力值ri, 规则是每个科目要么选要么不 ...

  10. alpa开发阶段团队贡献分

    这是我们团队之前决定的分配方式: 1.凡是认真完成自己任务的队员,都将有基础分30分(态度分). 2. 将整个项目细化为不同的任务,列出一个任务清单,在综合.协调完每名成员的意愿后,我会分配清单中的任 ...