⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gee1002.java

📁 研究生入学考试题
💻 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 + -