F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_29408977_18740\Main.java:1: 错误: 解析时已到达文件结尾
import java.util.Scanner; public class Main{	private static Scanner scanner;	private static int t[];	private static String name[]; 	public static void main(String[] args) {		scanner = new Scanner(System.in);		int cases = 1;// 计算次数		boolean boo = false;		while (scanner.hasNext()) {			int n = scanner.nextInt();			if (n == 0) {				break;			} 			name = new String[n];// 名字			String time[] = new String[n];// 时间			//接收数据			for (int i = 0; i < n; i++) {				name[i] = scanner.next();				time[i] = scanner.next();			}			t = new int[n];// 时间			// 计算时间			// 全部转化为分			for (int i = 0; i < n; i++) {				String[] split = time[i].split(":");				int h = Integer.parseInt(split[0]);				int m = Integer.parseInt(split[1]);				t[i] = h * 60 + m;			}			sort();// 进行排序			/*for (int i = 0; i < time.length; i++) {				System.out.println(t[i]);			}*/			if(boo){//不是第一个就先输出空行				System.out.println();			}			System.out.println("Case #"+cases);			int rank[] = new int[n];			rank[0] = 1;//排名			//先输出第一个			System.out.println(name[0]+" "+rank[0]);			for (int i = 1; i < n; i++) {				if(t[i] == t[i-1]){					rank[i] = rank[i-1];				}else {					rank[i] = i+1;				}				System.out.println(name[i]+" "+rank[i]);			}						cases++;			boo = true;		}	} 	// 排序	private static void sort() {		for (int i = 0; i < name.length - 1; i++) {			for (int j = i + 1; j < name.length; j++) {				if (t[i] > t[j]) {// 时间从小到大					swap(i, j);				} else if (t[i] == t[j]) {					if (name[i].compareTo(name[j]) > 0){						swap(i, j);					}				}			}		}	} 	// 交换	private static void swap(int i, int j) {		int temp = t[i];		t[i] = t[j];		t[j] = temp; 		String string = name[i];		name[i] = name[j];		name[j] = string;	}}
                                            	                               	                       	                              	                                        		                                 		              ^
1 个错误


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-16 21:25:40, Gzip enabled