URAL 1786 Sandro's Biography
2016-03-31 21:29
381 查看
Time limit: 1.0 second |
input | output |
---|---|
MyNameIsAlexander | 20 |
Notes
In the example the corrector will have to perform four operations after which the line will sequentially take the following form: “MyNameIsAlesander”, “MyNameIsAlesandrr”, “MyNameIsAlesandro”, and “MyNameIsAleSandro”.Problem Author: Olga Soboleva
Problem Source: Ural Regional School Programming Contest 2010
#include<iostream> #include<cstdlib> #include<string> #include<algorithm> #include<cstdio> #include<cmath> #include<cstring> #include<stack> #include<queue> #include<iomanip> #include<map> #include<set> #define pi 3.14159265358979323846 using namespace std; char s[210]; int main() { scanf("%s",&s); int len=strlen(s); int cnt,ans=1000; for(int i=0;i<=len-6;++i) { cnt=0; if(s[i]!='S') { if(s[i]=='s'||(s[i]>='A'&&s[i]<='Z')) ++cnt; else cnt+=2; } if(s[i+1]!='a') { if(s[i+1]=='A'||(s[i+1]>='a'&&s[i+1]<='z')) ++cnt; else cnt+=2; } if(s[i+2]!='n') { if(s[i+2]=='N'||(s[i+2]>='a'&&s[i+2]<='z')) ++cnt; else cnt+=2; } if(s[i+3]!='d') { if(s[i+3]=='D'||(s[i+3]>='a'&&s[i+3]<='z')) ++cnt; else cnt+=2; } if(s[i+4]!='r') { if(s[i+4]=='R'||(s[i+4]>='a'&&s[i+4]<='z')) ++cnt; else cnt+=2; } if(s[i+5]!='o') { if(s[i+5]=='O'||(s[i+5]>='a'&&s[i+5]<='z')) ++cnt; else cnt+=2; } ans=min(ans,cnt); } int zans=5*ans; printf("%d\n",zans); return 0; }
相关文章推荐
- hdu1874最短路
- 【转】java io复用模型
- 一种实现C++反射功能的想法(三)
- Ubuntu 12.4 配置android开发环境(转载)
- java中单项链表实现方法:增加、删除、插入数据
- Apache 403 Forbidden:You don't have permission to access / on this server.
- Apache 403 Forbidden:You don't have permission to access / on this server.
- 类像“一台数据引擎”
- 算法之大整数乘法
- 自定义控件之绘图篇(一):概述及基本几何图形绘制
- 算法之大整数乘法
- 【测试分析】基于状态的测试
- Django:之安全、国际化和session
- <php>PDO用法一
- <php>PDO链接方法
- swift - 访问控制
- ubuntu 12.04下开启root图形界面登录
- Android用Websocket实现聊天室
- C++实验2-学生成绩
- JqPagination动态分页,每次点击下一页都加载一次后台