随笔 - 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 飞翔天使 阅读(193) 评论(0)  编辑  收藏 所属分类: ACM

只有注册用户登录后才能发表评论。


网站导航: