隨筆 - 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 飛翔天使 閱讀(220) 評論(0)  編輯  收藏 所屬分類: ACM
          主站蜘蛛池模板: 望奎县| 眉山市| 株洲县| 香港 | 乡宁县| 南开区| 浮梁县| 大同市| 商城县| 宾川县| 忻州市| 肇东市| 凤城市| 洞口县| 卢氏县| 石狮市| 灌南县| 万荣县| 连山| 纳雍县| 齐齐哈尔市| 平阴县| 含山县| 怀柔区| 类乌齐县| 孟村| 绵阳市| 安平县| 大悟县| 肃南| 星座| 胶南市| 姚安县| 福清市| 县级市| 伊金霍洛旗| 新龙县| 都匀市| 永靖县| 涿鹿县| 珲春市|