/*实践再次说明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的更多相关文章

  1. Mobile Push Notification

    In one embodiment, a method includes sending to a mobile client computing device a first notificatio ...

  2. [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 ...

  3. 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 ...

  4. Indexing Sensor Data

    In particular embodiments, a method includes, from an indexer in a sensor network, accessing a set o ...

  5. Tagging Physical Resources in a Cloud Computing Environment

    A cloud system may create physical resource tags to store relationships between cloud computing offe ...

  6. jqgrid(转载)

    一.主要API接口getGridParam.setGridParam: getGridParam方法: getGridParam("url"): 获取当前的AJAX的URL get ...

  7. WAP网页输入框的默认键盘类型控制

    最近有用户反映手机网的输入框不够人性化,比如手机号.卡号输入框应该默认显示数字键盘,邮箱输入框应该默认显示邮箱键盘. 百度上对这样的资料介绍很多,基本上都和这个页面是一个意思 http://www.w ...

  8. JavaScript验证

    <script type="text/javascript">    /*密码*/    function password()    {        var pas ...

  9. MYSQL系列1_MySQL的安装,可视化工具的使用,以及建库建表等

    大家都知道MYSQL是开源的数据库,现在MYSQL在企业中的使用也越来越多,本人之前用过SQL SERVER数据库,因业务需要和自己的兴趣想要学习MYSQL,对于MYSQL,本人还是新手,请大家多多指 ...

随机推荐

  1. 【Python】range和xrange区别

    转自:http://www.cnblogs.com/zhangjing0502/archive/2012/05/16/2503880.html range    函数说明:range([start,] ...

  2. GridView中使用分页控件

    前台:导入<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix= ...

  3. Mysql 死锁的详细分析方法

    用数据库的时候,偶尔会出现死锁,针对我们的业务系统,出现死锁的直接结果就是系统卡顿.客户找事儿,所以我们也在想尽全力的消除掉数据库的死锁.出现死锁的时候,如果只是想解锁,用show full proc ...

  4. Android xml text 预览属性

    只在 AS 中生效 xmlns:tools="http://schemas.android.com/tools" tools:text="I am a title&quo ...

  5. NotePad ++的妙用:添加代码行数和格式不变复制代码

    NotePad ++ 不仅安装包小而且功能强大,可以支持很多语言.这里简单阐述下两个功能: 一.在代码前添加行数: 1.用NotePad ++打开一个文件,一般NotePad ++会自动识别这是什么语 ...

  6. 用java来删除数组中指定的元素

    public static void main(String[] args){        String[] a = new String[]{"1","5" ...

  7. Spring.Net的IOC入门

    1.构造器注入 namespace Spring.Net { class Program { //构造器注入 static void Main(string[] args) { IApplicatio ...

  8. Delphi的字符串、PChar和字符数组之间的转换

    参考:http://my.oschina.net/kavensu/blog/193719 以下的各种方法都是我在Delphi 6的环境下测试成功的,可能根据你的开发环境.不同的上下文语境……有一些可能 ...

  9. 【JAVA 文件概述】

    一.概述 使用此类的原因: 该类将文件或者文件夹封装成对象.方便对文件与文件夹的属性信息进行操作.File对象作为参数传递给流的构造函数.要求:使用File类的常用方法. windows平台下,目录分 ...

  10. 【叉积】【sdut 2508 图形密码】

    图形密码 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 题目链接:http://acm.sdut.edu.cn/sdutoj/p ...