?? gee1002.java
字號:
import java.io.BufferedReader;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class GEE1002
{
static String info[][];
public static void main(String args[])
{
java.io.BufferedReader bin = new BufferedReader(
new java.io.InputStreamReader(System.in));
try
{
int n = Integer.parseInt(bin.readLine());
for (int i = 0; i < n; ++i)
{
int rowNumber = Integer.parseInt(bin.readLine());
info = new String[rowNumber][3];
for (int j = 0; j < rowNumber; j++)
{
String temp = bin.readLine();
info[j][0] = temp.substring(0, temp.indexOf(' '));
temp = temp.substring(temp.indexOf(' ') + 1);
info[j][1] = temp.substring(0, temp.indexOf(' '));
temp = temp.substring(temp.indexOf(' ') + 1);
info[j][2] = temp;
}
SimpleDateFormat us = new SimpleDateFormat("HH:mm:ss");
int min = 0, max = 0;
for (int j = 1; j < rowNumber; ++j)
{
if (us.parse(info[j][1]).before(us.parse(info[min][1])))
min = j;
}
System.out.print(info[min][0]+" ");
for (int j = 1; j < rowNumber; ++j)
{
if (us.parse(info[j][2]).after(us.parse(info[max][2])))
max = j;
}
System.out.println(info[max][0]);
}
}
catch (NumberFormatException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (ParseException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -