http://acm.fjnu.edu.cn/show?problem_id=1769
打表,注意如果是其他字符,就不增加按键次数。
 import java.util.*;
import java.util.*;
 import java.io.*;
import java.io.*;


 public class ACM_1769
public class ACM_1769 {
{
 
    
 public static void main(String rgs[]) throws Exception
    public static void main(String rgs[]) throws Exception

 
     {
{
 BufferedReader stdin =
        BufferedReader stdin = 
 new BufferedReader(
            new BufferedReader(
 new InputStreamReader(System.in));
                new InputStreamReader(System.in));

 int[] a=new int[]
        int[] a=new int[] {0,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4};
{0,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4};
 String s =null;
           String s =null;

 while((s = stdin.readLine())!=null)
          while((s = stdin.readLine())!=null) {
{
 int count=0;
              int count=0;

 for(int i=0;i<s.length();i++)
            for(int i=0;i<s.length();i++) {
{
 char c=s.charAt(i);
                char c=s.charAt(i);
 if(c>='a' && c<='z')
                if(c>='a' && c<='z')
 count+=a[c-96];
                    count+=a[c-96];
 else if(c==' ')
                else if(c==' ')
 count++;
                    count++;
 }
            }
 System.out.println(count);
            System.out.println(count);
 }
        }
 }
    }
 }
}posted on 2009-09-27 10:22 
飞翔天使 阅读(222) 
评论(0)  编辑  收藏  所属分类: 
ACM