6754 Keyboard of a Mobile Telephone
/*实践再次说明ch=getchar()的速度非常慢*/
/*大水题,不解释*/
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,n,count;
int a[];
char ch,s[];
j=;
for(i=; i<=; i++)
{
if(j>) j=;
a[i]=j;
j++;
}
a[]=;
a[]=;
a[]=;
a[]=;
a[]=;
a[]=;
a[]=;
a[]=;
a[]=;
scanf("%d",&n);
getchar();
for(i=; i<=n; i++)
{
count=;
gets(s);
for(j=;j<strlen(s);j++)
count+=a[s[j]];
printf("%d\n",count);
}
return ;
}
时间限制:500MS 内存限制:1000K 提交次数:95 通过次数:27
题型: 编程题 语言: C++;C
Description
Now almost every student has a mobile telephone. But do you have making attention to the keyboard of a mobile telephone? This is the keyboard of a normal mobile telephone:
It will show different letters if you press one key different times, for example you press the key “2” once it will show a letter ‘a’, twice show a ‘b’. And notice that press the key ‘0’ once will show a space. Now give you a sentence, which contains only lowercases and space, calculate how much times to press the keyboard at least to show the sentence.
输入格式
The first line contains an integer n, which means the number of cases. Per case consist of only one sentence, which contains only lowercases and spaces and its length less or equal 200.
输出格式
Per case output an integer, which is the least times to press the keyboard, in one line.
输入样例
1this problem is so easy
输出样例
53
Time:15ms
6754 Keyboard of a Mobile Telephone的更多相关文章
- Mobile Push Notification
In one embodiment, a method includes sending to a mobile client computing device a first notificatio ...
- [React Native] Prevent the On-screen Keyboard from Covering up Text Inputs
When you bring up the on screen keyboard in a mobile app, it will cover any text input or buttons on ...
- Operating system management of address-translation-related data structures and hardware lookasides
An approach is provided in a hypervised computer system where a page table request is at an operatin ...
- Indexing Sensor Data
In particular embodiments, a method includes, from an indexer in a sensor network, accessing a set o ...
- Tagging Physical Resources in a Cloud Computing Environment
A cloud system may create physical resource tags to store relationships between cloud computing offe ...
- jqgrid(转载)
一.主要API接口getGridParam.setGridParam: getGridParam方法: getGridParam("url"): 获取当前的AJAX的URL get ...
- WAP网页输入框的默认键盘类型控制
最近有用户反映手机网的输入框不够人性化,比如手机号.卡号输入框应该默认显示数字键盘,邮箱输入框应该默认显示邮箱键盘. 百度上对这样的资料介绍很多,基本上都和这个页面是一个意思 http://www.w ...
- JavaScript验证
<script type="text/javascript"> /*密码*/ function password() { var pas ...
- MYSQL系列1_MySQL的安装,可视化工具的使用,以及建库建表等
大家都知道MYSQL是开源的数据库,现在MYSQL在企业中的使用也越来越多,本人之前用过SQL SERVER数据库,因业务需要和自己的兴趣想要学习MYSQL,对于MYSQL,本人还是新手,请大家多多指 ...
随机推荐
- yii压缩
application\components\controller.php protected function afterRender($view, &$output) { if(Yii:: ...
- XP/Win7下QTP11循环试用30天的破解方法
XP/Win7下QTP11循环试用30天的破解方法. XP下:1.找到以下路径:C:\Documents and Settings\All Users\Application Data\SafeNet ...
- iOS应用架构谈(二):View层的组织和调用方案(上)
OS客户端应用架构看似简单,但实际上要考虑的事情不少.本文作者将以系列文章的形式来回答iOS应用架构中的种种问题,本文是其中的第二篇,主要讲View层的组织和调用方案.上篇主要讲View层的代码结构. ...
- mybatis配置问题
//当构造函数有多个参数时,可以使用constructor-arg标签的index属性,index属性的值从0开始. <bean id="sqlSession" class= ...
- FastPolice项目总结
This is the final homework for spatial information Mobile Service Lesson.It generally inclusived the ...
- Python中读取csv文件内容方法
gg 224@126.com 85 男 dd 123@126.com 52 女 fgf 125@126.com 23 女 csv文件内容如上图,首先导入csv包,调用csv中的方法reader()创建 ...
- Java集合源码学习(二)ArrayList分析
>>关于ArrayList ArrayList直接继承AbstractList,实现了List. RandomAccess.Cloneable.Serializable接口,为什么叫&qu ...
- 重温WCF之WCF传输安全(十三)(2)基于SSL的WCF匿名客户端(转)
转载地址:http://www.cnblogs.com/lxblog/archive/2012/09/13/2683514.html 这一篇我们利用上一篇制作的证书,来演示一个基于SSL的WCF服务, ...
- UVA 10828 Back to Kernighan-Ritchie(高斯消元)
高斯消元求概率 对于非起点,期望x[i] = ∑x[j] / deg[j] #include<cstdio> #include<iostream> #include<cs ...
- VS2013 当前不会命中断点,还没有为该文档加载任何符号
方法一: 把ie的 调试 打开,然后调试的时候 会问你 是在新示例中打开 还是 当前示例,你选择当前的就行了.还有 建议你用 ie8.0的 开发者工具 调试 非常舒服 我已经 早就不用debuger ...