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,本人还是新手,请大家多多指 ...
随机推荐
- Oracle数据库对象题库
一. 填空题 在用 create 语句创建基本表时,最初只是一个空的框架,用户可以使用insert命令把数据插入表中. 在基本表不需要时,可以使用 drop table 语句撤消.在一个基本表撤 ...
- Mac 安装 eclipse
总是看着安卓的代码感觉手痒痒,闲来无事在 Mac 端安装了一下eclipse 提高逼格. 1.官网(http://www.eclipse.org/downloads/)下载所需的安装包,具体步骤如图: ...
- October 8th 2016 Week 41st Saturday
When ambition ends, happiness begins. 野心消亡之日,正是快乐破茧之时. If I don't have the wish to be a useful man, ...
- chaper3_exerise_Uva1568_Molar_Mass_分子量
#include<iostream> #include<iomanip> #include<string> #include<cctype> using ...
- NYOJ题目769乘数密码
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsQAAAJYCAIAAADqk2fsAAAgAElEQVR4nO3dPVLrytbG8XcS5AyEWA
- 傻瓜式十分钟免费开启 HTTPS,是时候为你的站点加上小绿锁了
http://gold.xitu.io/entry/57df65690bd1d00057f9455b?from=singlemessage&isappinstalled=0 原文链接:http ...
- 七牛---以一个七牛上传的实例小结下AJAX跨域【转】
http://blog.csdn.net/netdxy/article/details/50699842 使用七牛过程中,很多用户或多或少遇到跨域的问题,这篇文章主要介绍下跨域的概念来看什么情况下会出 ...
- C++杂记
变量就是一个地址,同进程内可以直接访问,要做好线程之间的同步就是了.——摘自CSDN 2015-06-18 16:58:10(注:注意变量的生命周期(作用域就可以不在意))
- Python 自然语言处理(1) 计数词汇
Python有一个自然语言处理的工具包,叫做NLTK(Natural Language ToolKit),可以帮助你实现自然语言挖掘,语言建模等等工作.但是没有NLTK,也一样可以实现简单的词类统计. ...
- 拷贝,集合,函数,enumerate,内置函数
1.拷贝 字符串和数字.赋值 id一样 import copy #提供拷贝功能 copy.copy() #原来的和现在的一起修改,不用修改时用浅copy,节省内存,复制最外层 copy.deepcop ...