隨筆 - 147  文章 - 71  trackbacks - 0
          <2009年9月>
          303112345
          6789101112
          13141516171819
          20212223242526
          27282930123
          45678910

          常用鏈接

          留言簿(1)

          隨筆分類(146)

          隨筆檔案(147)

          文章分類(28)

          文章檔案(28)

          喜歡的Blog

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

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

          public class ACM_1769{
              
              
          public static void main(String rgs[]) throws Exception
              
          {
                  BufferedReader stdin 
          = 
                      
          new BufferedReader(
                          
          new InputStreamReader(System.in));
                  
          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};
                     String s 
          =null;
                    
          while((s = stdin.readLine())!=null){
                        
          int count=0;
                      
          for(int i=0;i<s.length();i++){
                          
          char c=s.charAt(i);
                          
          if(c>='a' && c<='z')
                              count
          +=a[c-96];
                          
          else if(c==' ')
                              count
          ++;
                      }

                      System.out.println(count);
                  }

              }

          }
          posted on 2009-09-27 10:22 飛翔天使 閱讀(211) 評論(0)  編輯  收藏 所屬分類: ACM
          主站蜘蛛池模板: 新郑市| 鄢陵县| 黎平县| 内黄县| 阳新县| 九台市| 陕西省| 开封县| 石景山区| 嘉禾县| 杭锦后旗| 诸暨市| 沾化县| 通城县| 从化市| 宁明县| 内乡县| 唐河县| 郎溪县| 磴口县| 常州市| 昭苏县| 潼关县| 原阳县| 平邑县| 东台市| 水城县| 栖霞市| 故城县| 蒙阴县| 台东县| 浮梁县| 武功县| 固阳县| 柳江县| 道真| 西乌珠穆沁旗| 梅河口市| 潍坊市| 定陶县| 巫山县|