Codeforces Round #376 (Div. 2) A. Night at the Museum(水题)
来源:互联网 发布:诚造社变形金刚淘宝 编辑:程序博客网 时间:2024/05/16 17:32
题目链接:http://codeforces.com/contest/731/problem/A
中文题意:从a开始走,走完所有的字母需要走多少步。
直接模拟过程就OK了。
下面是AC代码:
#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>using namespace std;char a[105];int main(){ while(~scanf("%s",a)) { int sum=0; int l=strlen(a); sum+=min(abs(a[0]-'a'),26-abs(a[0]-'a')); for(int i=1;i<l;i++) { sum+=min(abs(a[i]-a[i-1]),26-abs(a[i]-a[i-1])); } printf("%d\n",sum); } return 0;}
0 0
- Codeforces Round #376 (Div. 2) A. Night at the Museum
- Codeforces Round #376 (Div. 2) A. Night at the Museum
- Codeforces Round #376 (Div. 2) A. Night at the Museum(水题)
- 【Codeforces Round #376 (Div. 2)】 Codeforces 731A Night at the Museum
- Codeforces Round #376 (Div. 2) A. Night at the Museum【模拟】
- Codeforces Round #376 (Div. 2) A. Night at the Museum —— 循环轴
- CodeForces 731A Night at the Museum
- CodeForces 731A Night at the Museum
- CodeForces 731A-Night at the Museum
- codeforces 731A Night at the Museum
- CodeForces 731A Night at the Museum
- CodeForces 731 A.Night at the Museum(水~)
- A. Night at the Museum
- Night at the Museum(水题)
- 【87.65%】【codeforces 731A】Night at the Museum
- CodeForces 731A 之 Night at the Museum
- CodeForces 731A - Night at the Museum(模拟)
- CodeForces 731A Night at the Museum(博物馆循环的单词表)
- MyBatis总结——开发Dao的方法
- Block 一张图秒懂jadeBlock 语法
- Android开发的项目框架的搭建
- chcon -t textrel_shlib_t
- PHP经典实例读书笔记--函数
- Codeforces Round #376 (Div. 2) A. Night at the Museum(水题)
- 并查集详解
- 断点续传
- 关于memcache和Redis的区别和总结
- MFC错误”D8016:‘/ZI’和‘/Gy-’命令行选项不兼容“的解决方法
- 每天一个常用的linux命令(12)--whereis
- C#语法小知识(十二)匿名方法与Lambda表达式
- uva437 DAG
- linux C编程 进程操作