Input |
---|
3CS301111 15:30:28 17:00:10SC3021234 08:00:00 11:25:25CS301133 21:45:00 21:58:40 |
Output |
SC3021234 CS301133 |
Notes 作者 CHEN, Yue
利用好scanf格式化输入。
#include <iostream>#include <algorithm>#include <map>#include <vector>#include <functional>#include <string>#include <cstring>#include <queue>#include <set>#include <stack>#include <cmath>#include <cstdio>#include <sstream>#include <iomanip>using namespace std;#define IOS ios_base::sync_with_stdio(false)#define TIE std::cin.tie(0)#define MIN2(a,b) (a<b?a:b)#define MIN3(a,b) (a<b?(a<c?a:c):(b<c?b:c))#define MAX2(a,b) (a>b?a:b)#define MAX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))typedef long long LL;typedef unsigned long long ULL;const int INF = 0x3f3f3f3f;const double PI = 4.0*atan(1.0);const double eps = 1e-6;int M, h, m, s, t, t1, t2;char str[20],up[20],lp[20];int main(){ scanf("%d", &M); t1 = INF; t2 = 0; for (int i = 0; i < M; i++){ scanf(" %s", str); scanf("%d:%d:%d", &h, &m, &s); t = h * 3600 + m * 60 + s; if (t < t1){ t1 = t; strcpy(up, str); } scanf("%d:%d:%d", &h, &m, &s); t = h * 3600 + m * 60 + s; if (t > t2){ t2 = t; strcpy(lp, str); } } PRintf("%s %s/n", up, lp); //system("pause");}新闻热点
疑难解答