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

          常用鏈接

          留言簿(1)

          隨筆分類(146)

          隨筆檔案(147)

          文章分類(28)

          文章檔案(28)

          喜歡的Blog

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          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 飛翔天使 閱讀(220) 評(píng)論(0)  編輯  收藏 所屬分類: ACM
          主站蜘蛛池模板: 巴中市| 万载县| 英吉沙县| 茶陵县| 天门市| 高碑店市| 澄江县| 林口县| 龙里县| 城步| 拜泉县| 威海市| 饶平县| 盐池县| 新晃| 聂荣县| 蒲城县| 泸水县| 玛多县| 萨迦县| 沾益县| 县级市| 阿瓦提县| 东城区| 泸溪县| 葫芦岛市| 寿宁县| 崇信县| 庆城县| 寿光市| 类乌齐县| 驻马店市| 土默特右旗| 雷州市| 兴海县| 濮阳县| 兴仁县| 五家渠市| 辽阳市| 临朐县| 南靖县|