隨筆 - 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
          打表,注意如果是其他字符,就不增加按鍵次數。
          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 飛翔天使 閱讀(210) 評論(0)  編輯  收藏 所屬分類: ACM
          主站蜘蛛池模板: 隆德县| 丰顺县| 石柱| 贵州省| 利津县| 宁国市| 赫章县| 内黄县| 开江县| 洛阳市| 六枝特区| 久治县| 中山市| 平罗县| 克拉玛依市| 监利县| 和政县| 康保县| 泾川县| 平罗县| 万州区| 巴南区| 抚州市| 静乐县| 丰台区| 凯里市| 汤原县| 大化| 普宁市| 柳河县| 康乐县| 禹城市| 巴林右旗| 龙海市| 宜兰市| 泗洪县| 岚皋县| 读书| 视频| 牟定县| 元谋县|