求高手帮我看看这道题为什么只是部分正确(我很渣不要嘲笑我......)

乔见你妹 2015-08-09 06:30:04
1006. Sign In and Sign Out (25)

时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked and locked the door on that day.

Input Specification:

Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:

ID_number Sign_in_time Sign_out_time
where times are given in the format HH:MM:SS, and ID number is a string with no more than 15 characters.

Output Specification:

For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.

Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.

Sample Input:
3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40
Sample Output:
SC3021234 CS301133
...全文
71 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
乔见你妹 2015-08-09
  • 打赏
  • 举报
回复
[code=java][/codimport java.io.BufferedInputStream; import java.util.Arrays; import java.util.Scanner; public class f1006 { public static void main(String[] args) { Scanner sc = new Scanner(new BufferedInputStream(System.in)); while(sc.hasNextLine()){ int num = sc.nextInt(); int i=0; String idarr[] = new String[num]; String ftime[] = new String[num]; String ltime[] = new String[num]; while(num!=0){ --num; idarr[i]= sc.next(); ftime[i]= sc.next(); ltime[i]= sc.next(); ++i; } String ftime2[] = ftime.clone(); String ltime2[] = ltime.clone(); Arrays.sort(ftime2); Arrays.sort(ltime2); for(int j=0;j<ftime.length;j++){ if(ftime2[0].equals(ftime[j])){ System.out.print(idarr[j]); } } for(int j=0;j<ftime.length;j++){ if(ftime2[ftime2.length-1].equals(ftime[j])){ System.out.print(" "+idarr[j]); } } System.out.println(); } } }]

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧