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 ...
随机推荐
- 自建mvc5项目里几个类图
AccoutController.cs AccountViewModels.cs IdentityModel.cs
- Luogu P3825 [NOI2017]游戏
这道题看上去NPC啊,超级不可做的样子. 我们先分析一下简单的情形:没有\(x\)地图 此时每个地图由于限制掉一种汽车,那么显然只会有两种选择. 再考虑到限制的情况,那么大致做法就很显然了--2-SA ...
- 【php增删改查实例】第十三节 - EasyUI列格式化
因为easyUI的datagrid组件是横着一格一格加载数据的,一行加载好了之后才会去加载下一行.所谓的列格式化,就是在加载某一列的所有单元格时,对即将加载到这些单元格的数据进行二次包装. 比如,我们 ...
- 洛谷 4823 [TJOI2013]拯救小矮人
题目链接-> 噔楞 题解: 贪心 按个高+臂长排序. 个矮臂长的先走,个高臂短的后走 #include <cstdio> #include <cstring> #incl ...
- 《Head First 设计模式》例子的C++实现(2 观察者模式)
最近在学习设计模式,用的是 <Head First 设计模式>这本书.感觉这本书写的还是很不错的,深入浅出的介绍了各种常用的设计模式.唯一有点不方便的地方是这本书的例子全都是用的 Java ...
- 面试3——java集合类总结(List)
1.集合类 数组:可以存储对象,也可以存储基本数据类型,但是一次只能存储一种类型,且长度一定,不可改变. 集合:只能存储对象,长度可变,可以存储不同类型的对象.Java集合类主要有三种:set,lis ...
- Kafka(分布式发布-订阅消息系统)工作流程说明
Kafka系统架构Apache Kafka是分布式发布-订阅消息系统.它最初由LinkedIn公司开发,之后成为Apache项目的一部分.Kafka是一种快速.可扩展的.设计内在就是分布式的,分区的和 ...
- Java开发23种设计模式之禅
六大原则 23种设计模式: 总体来说设计模式分为三大类: *创建型模式,共五种:工厂方法模式.抽象工厂模式.单例模式.建造者模式.原型模式. *结构型模式,共七种:适配器模式.装饰器模式.代理模式.外 ...
- 个人阅读作业2:结合《No Silver Bullet》谈谈我在软件开发过程的遇到的困难与体会
英文捉急,只能挑一段看得比较懂的,而且正好和我们现在编程任务联系比较紧密的内容来谈一谈体会. 在<No Silver Bullet>中,作者描述了造成软件本质性困难(essence)的四个 ...
- 关于五子棋游戏java版
一 题目简介:关于五子棋游戏 二 源码的github链接 https://github.com/marry1234/test/blob/master/五子棋游戏 三.所设计的模块测试用例.测试结果 ...