隨筆 - 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=1770
          import java.util.*;
          import java.io.*;

          public class ACM_1770{
              
              
          public static void main(String rgs[]) throws Exception
              
          {
                  BufferedReader stdin 
          = 
                      
          new BufferedReader(
                          
          new InputStreamReader(System.in));
                  String line 
          = stdin.readLine(); 
                  
          int i,j,n = Integer.parseInt(line); 
                  String[] s
          =new String[n+1];
                  
          int[] a=new int[n+1];
                  
          int count=0;
                  Arrays.fill(a,
          0);
                  
          for(i=1;i<=n;i++)
                      s[i] 
          = stdin.readLine();
                  i
          =1;
                  
          while(true){
                      StringTokenizer st 
          = new StringTokenizer(s[i]);
                      String t
          =st.nextToken();
                      
          if(a[i]==1){
                          count
          =0;
                          
          break;
                      }

                      a[i]
          =1;
                      count
          ++;
                      
          if(t.equals("jmp")){
                          j
          =Integer.parseInt(st.nextToken());
                          i
          =j;
                          
          continue;
                      }

                      i
          ++;                
                      
          if(i>n)
                          
          break;
                  }

                  System.out.println(count);
              }

          }
          posted on 2009-09-28 09:52 飛翔天使 閱讀(215) 評論(0)  編輯  收藏 所屬分類: ACM
          主站蜘蛛池模板: 晋州市| 伊春市| 建湖县| 文安县| 枣庄市| 广南县| 且末县| 千阳县| 绥化市| 龙岩市| 六安市| 仁化县| 荣成市| 双鸭山市| 安吉县| 大同市| 石渠县| 旺苍县| 交城县| 共和县| 万载县| 赤峰市| 吴川市| 奈曼旗| 舞阳县| 博乐市| 浮梁县| 盐边县| 顺平县| 灵宝市| 盐源县| 葵青区| 巨鹿县| 常州市| 淮北市| 浑源县| 商都县| 高碑店市| 丹凤县| 姚安县| 苍溪县|