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 写的,为什么RE?谢谢大牛们指点。

Posted by D00109 at 2009-09-13 10:18:16 on Problem 2371
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);        
        int N=Integer.parseInt(in.nextLine());
        int [] database=new int [N];
        while(true){
        for(int i=0;i<database.length;i++) database[i]=Integer.parseInt(in.nextLine());
        Arrays.sort(database);
        String temp=in.nextLine();
        if(temp.equals("###"))
        {
        int []query=new int[Integer.parseInt(in.nextLine())];
          for(int i=0;i<query.length;i++)
          {
            query[i]=Integer.parseInt(in.nextLine())-1;
            System.out.println(database[query[i]]);
          }
        }
        if(in.hasNextInt()==false) break;
        }
    }
}


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