Atcoder Beginner Contest 155E(DP)
#definde HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
char s[];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>s+;
int n=strlen(s+);
int ans=;
for(int i=n;i;--i){
if(s[i]<''||s[i]==''&&s[i-]<'')
ans+=s[i]-'';
else{
ans+=-(s[i]-'');
++s[i-];
}
}
if(s[])
++ans;
cout<<ans;
return ;
}
Atcoder Beginner Contest 155E(DP)的更多相关文章
- AtCoder Beginner Contest 254(D-E)
Tasks - AtCoder Beginner Contest 254 D - Together Square 题意: 给定一个N,找出所有不超过N的 ( i , j ),使得( i * j )是一 ...
- AtCoder Beginner Contest 086 (ABCD)
A - Product 题目链接:https://abc086.contest.atcoder.jp/tasks/abc086_a Time limit : 2sec / Memory limit : ...
- AtCoder Beginner Contest 085(ABCD)
A - Already 2018 题目链接:https://abc085.contest.atcoder.jp/tasks/abc085_a Time limit : 2sec / Memory li ...
- AtCoder Beginner Contest 084(AB)
A - New Year 题目链接:https://abc084.contest.atcoder.jp/tasks/abc084_a Time limit : 2sec / Memory limit ...
- AtCoder Beginner Contest 083 (AB)
A - Libra 题目链接:https://abc083.contest.atcoder.jp/tasks/abc083_a Time limit : 2sec / Memory limit : 2 ...
- AtCoder Beginner Contest 264(D-E)
D - "redocta".swap(i,i+1) 题意: 给一个字符串,每次交换相邻两个字符,问最少多少次变成"atcoder" 题解: 从左到右依次模拟 # ...
- Atcoder Grand Contest 031B(DP,思维)
#include<bits/stdc++.h>using namespace std;int a[200007];int b[200007];long long dp[200007];lo ...
- Atcoder Beginner Contest 121D(异或公式)
#include<bits/stdc++.h>using namespace std;int main(){ long long a,b; cin>>a>&g ...
- Atcoder Beginner Contest 156E(隔板法,组合数学)
#define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ; ; long long fac[N] ...
随机推荐
- UVA10085-不知错在何处
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #i ...
- sqli-labs less-11 --> less-12
Less-11(报错注入POST方式) 1.判断是否存在注入点 因为是POST 方式的与GET方式稍有不同,可以选择使用burp suite以及火狐的hackbar进行操作,直接在输入框usernam ...
- Git常用命令简记
创建仓库 添加需要版本控制的文件到仓库中 提交到版本库 修改位于顶端的commit的日志 分支管理 版本回退 切换与合并分支 本地版本库与远程关联 克隆 Tag的使用 问题与解决 创建git仓库 gi ...
- 摇一摇—微信7.0.8版本audio无法自动播放问题
近日有一个项目出现audio无法自动播放,查看原因才发现是微信版本更新为7.0.8版本,需要有交互行为,第一次播放需要用户手动点击一下,无法使用DOM中的play()进行直接播放操作,那怎么办呢? 通 ...
- MongoDB一些应用知识点
1.在生产环境中至少需要三个节点的复制集架构. 2.在多数的场景中WT引擎比MMAPv1更加出色. 3.要想达到极致的速度,那么一定要给MongoDB足够的内存. 4.避免使用短链接,充分利用连接池, ...
- 粒子群算法优化BP生物能神经网络
定义: 粒子群中每个粒子的位置表示BP神经网络当前迭代中权值的集合,每个粒子的维数由网络中起连接作用的权值的数量和阈值个数决定,以给定训练样本集的神经网络输出误差作为神经网络训练问题的适应度函数,适应 ...
- vjudge A Funny Game 思维题 (其实今天讲的全是数学。。。)
原文链接https://vjudge.net/contest/331993#problem/H Alice and Bob decide to play a funny game. At the be ...
- PP: Imaging time-series to improve classification and imputation
From: University of Maryland encode time series as different types of images. reformulate features o ...
- (转)最小Hash和局部敏感Hash
转自:http://www.07net01.com/2015/08/907327.html 在数据挖掘中,有一个比较基本的问题,就是比较两个集合的相似度.关于这个问题,最笨的方法就是用一个两重循环来遍 ...
- Python标准库之sys模块
获取Python解释器的版本信息 import sys print(sys.version) #输出 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) ...