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;
}
上一篇:Shiro权限管理框架详解


下一篇:matlab遗传算法工具箱