Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Java: Why WA?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator