标签:des style blog color java strong io for
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 10658 Accepted Submission(s): 5434
解题思路:就是找出开门时间最小的,然后找出关门时间最大的。
贴代码:
#include <stdio.h> #include <string.h> struct Node { char name[25]; int sh, sm, ss; int fh, fm, fs; }; struct Node node[1005]; int main() { int n, T; int x, y; int mh, mm, ms; int kh, km, ks; while(scanf("%d", &T)!=EOF) { while(T--) { mh = 25; mm = 61; ms = 61; kh = -1; km = -1; ks = -1; scanf("%d", &n); for(int i = 1; i<=n; i++) { scanf("%s %d:%d:%d %d:%d:%d", node[i].name, &node[i].sh, &node[i].sm, &node[i].ss, &node[i].fh, &node[i].fm, &node[i].fs); if(node[i].sh < mh) { x = i; mh = node[i].sh; mm = node[i].sm; ms = node[i].ss; } else if(node[i].sh <= mh && node[i].sm <mm) { x = i; mh = node[i].sh; mm = node[i].sm; ms = node[i].ss; } else if(node[i].sh <= mh && node[i].sm <= mm && node[i].ss <= ms) { x = i; mh = node[i].sh; mm = node[i].sm; ms = node[i].ss; } if(node[i].fh > kh) { y = i; kh = node[i].fh; km = node[i].fm; ks = node[i].fs; } else if(node[i].fh >= kh && node[i].fm > km) { y = i; kh = node[i].fh; km = node[i].fm; ks = node[i].fs; } else if(node[i].fh >= kh && node[i].fm >= km && node[i].fs > ks) { y = i; kh = node[i].fh; km = node[i].fm; ks = node[i].fs; } } printf("%s %s\n", node[x].name, node[y].name); } return 0; } }
hdu 1234 开门人和关门人(简单题),布布扣,bubuko.com
标签:des style blog color java strong io for
原文地址:http://www.cnblogs.com/fengxmx/p/3886671.html