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 写的,为什么RE?谢谢大牛们指点。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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator