Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Java: Why WA?

Posted by javaWarrior at 2007-06-02 08:53:00 on Problem 2153
What is WRONG?


import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException{
	
	//BufferedReader br=new BufferedReader(new FileReader("in.txt"));	
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));	
	StringBuffer s= new StringBuffer();		
	String linea;
	StringTokenizer st;
	
	while((linea = br.readLine())!=null)
	{
			
    int n= new Integer(linea);
	
    for(int i=0;i<n;i++)
    br.readLine();	
        
    int m= new Integer(br.readLine());
	      
    for(int i=0;i<m;i++){
    
    int scores[]=new int[101];
    
    int max=0;
    int min=0;
    
    for(int j=0;j<n;j++){
    	
    st= new StringTokenizer(br.readLine());
    
    int score=new Integer(st.nextToken());
            
    String nombre;
    
    StringBuffer buf=new StringBuffer();
    
    while(st.hasMoreTokens())
    buf.append(st.nextToken());
    
    nombre = buf.toString();
   
    max=Math.max(max,score);
    
    if(nombre.equals("LiMing"))
    min=score;
    else         
    scores[score]++;
      
    }
    
    int rank=1;
    
    for(int j=max;j>min;j--)
     	if(scores[j]>0)
        rank+=scores[j]; 
    
    s.append(rank+"\n");
    
    }	
    
	}

	System.out.println(s);
 }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator