赞
踩
问题描述
小蓝手里有一份2022年度自己的上班打卡记录文件,文件包含若干条打
卡记录,每条记录的格式均为“yyyy-MM-dd HH:mm:ss”,即按照年-
月-日 时:分:秒的形式记录着一个时间点(采用24小时进制)。由于某些
原因,这份文件中的时间记录并不是按照打卡的时间顺序记录的,而是被
打乱了。但我们保证小蓝每次上班和下班时都会正常打卡,而且正好打卡
一次,其它时候不会打卡。每一对相邻的上-下班打卡之间的时间就是小蓝
本次的工作时长,例如文件内容如下的话:
2022-01-01 12:00:05
2022-01-02 00:20:05
2022-01-01 07:58:02
2022-01-01 16:01:35
表示文件中共包含了两段上下班记录,1)2022-01-01 07:58:02~2022
-01-01 12:00:05,工作时长为14523秒;2)2022-01-01 16:01:35~
2022-01-02 00:20:05,工作时长为29910秒;工作时长一共是
14523+29910=44433秒。现在小蓝想知道在2022年度自己的工作
时长一共是多少秒?
答案提交
这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为
个整数,在提交答案时只填写这个整数,填写多余的内容将无法得分。
- #include<bits/stdc++.h>
- #pragma GCC optimize(2)
- #define int long long
- #define PII pair<int, int>
-
- using namespace std;
- const int N = 6e2 + 10;
-
- struct date {
- int mou, day;
- int h, mi, s;
- }d[N];
-
- int th, tmi, ts, ans;
-
- bool cmp(date a, date b)
- {
- if(a.mou != b.mou)
- return a.mou < b.mou;
- else
- if (a.day != b.day)
- return a.day < b.day;
- else
- if(a.h != b.h)
- return a.h < b.h;
- else
- if(a.mi != b.mi)
- return a.mi < b.mi;
- else
- return a.s < b.s;
- }
-
- void solve()
- {
- for(int i = 0; i < 520; i += 2)
- {
- if(d[i].day == d[i + 1].day)
- {
- ans += 3600 * (d[i + 1].h - d[i].h) + 60 * (d[i + 1].mi - d[i].mi) + (d[i + 1].s - d[i].s);
- } else {
- ans += 3600 * (24 - d[i].h + d[i + 1].h) + 60 * (60 - d[i].mi + d[i + 1].mi) + (60 - d[i].s + d[i + 1].s);
- }
- }
- cout << ans << endl;
- }
-
- int32_t main()
- {
- ios::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- int _ = 1;
- // cin >> _;
-
- for (int i = 0; i < 520; ++i) {
- string s;
- getline(cin, s);
-
- d[i].mou = (s[6] - '0') + (s[5] - '0') * 10;
- d[i].day = (s[9] - '0') + (s[8] - '0') * 10;
- d[i].h = (s[12] - '0') + (s[11] - '0') * 10;
- d[i].mi = (s[15] - '0') + (s[14] - '0') * 10;
- d[i].s = (s[18] - '0') + (s[17] - '0') * 10;
- }
-
- sort(d, d + 520, cmp);
-
- while(_--) solve();
-
- return 0;
- }
2022-11-17 10:20:18
2022-05-06 20:04:02
2022-06-24 08:38:10
2022-06-15 21:35:55
2022-01-18 02:44:16
2022-10-31 18:20:23
2022-12-20 07:17:03
2022-06-22 02:32:46
2022-07-08 00:14:08
2022-04-06 19:54:59
2022-10-04 15:11:49
2022-07-18 23:37:09
2022-03-16 22:11:59
2022-06-13 22:50:14
2022-12-12 18:40:44
2022-05-16 15:38:03
2022-01-20 17:53:05
2022-11-14 13:44:48
2022-04-28 10:03:21
2022-06-14 10:24:23
2022-12-29 20:19:07
2022-10-14 20:12:59
2022-03-30 16:41:27
2022-01-05 21:10:52
2022-09-06 22:23:17
2022-01-21 07:58:27
2022-02-07 22:41:33
2022-12-22 07:34:07
2022-01-07 13:36:54
2022-08-26 18:42:51
2022-05-23 23:58:19
2022-12-27 11:20:36
2022-05-11 01:20:03
2022-02-08 01:54:27
2022-10-24 16:45:39
2022-02-18 23:10:14
2022-11-23 17:50:14
2022-06-02 22:51:41
2022-05-23 22:53:10
2022-07-08 12:12:00
2022-05-24 16:48:45
2022-07-20 00:45:05
2022-10-07 23:59:05
2022-10-06 19:59:36
2022-06-15 23:04:21
2022-02-22 09:05:36
2022-12-01 20:14:39
2022-04-08 07:22:16
2022-10-27 19:55:20
2022-09-28 19:58:37
2022-09-12 16:27:24
2022-12-15 21:51:56
2022-12-14 14:50:32
2022-01-31 02:35:06
2022-07-06 14:54:49
2022-03-22 10:23:41
2022-01-19 14:56:25
2022-06-17 20:43:01
2022-02-02 22:03:49
2022-12-28 23:48:57
2022-09-27 23:30:16
2022-02-17 23:24:14
2022-10-25 21:54:59
2022-10-10 05:55:46
2022-04-12 23:14:21
2022-07-11 14:20:06
2022-05-11 02:25:41
2022-05-31 18:49:19
2022-06-07 16:56:46
2022-12-08 21:28:26
2022-01-06 06:07:45
2022-06-01 17:37:30
2022-09-15 23:57:34
2022-07-01 22:34:51
2022-07-20 22:28:24
2022-08-04 01:32:52
2022-06-29 11:52:59
2022-06-01 20:49:20
2022-02-03 06:17:23
2022-02-01 06:46:12
2022-03-01 07:42:39
2022-11-10 21:30:10
2022-03-30 15:35:09
2022-08-11 15:23:50
2022-07-14 05:37:42
2022-01-14 20:08:09
2022-08-24 17:22:42
2022-02-23 05:35:26
2022-09-28 17:10:44
2022-01-11 16:09:26
2022-09-05 22:47:06
2022-06-28 21:35:22
2022-11-21 20:42:51
2022-09-05 13:58:45
2022-10-04 05:18:27
2022-10-26 17:51:11
2022-05-12 21:03:45
2022-06-08 23:56:29
2022-05-20 00:22:53
2022-05-03 09:34:11
2022-06-21 02:25:49
2022-01-21 10:09:52
2022-08-19 00:29:57
2022-05-06 20:16:50
2022-08-19 20:31:16
2022-04-20 07:17:25
2022-09-26 21:20:46
2022-05-09 07:12:27
2022-01-26 07:47:50
2022-02-24 03:42:14
2022-08-03 08:11:26
2022-12-26 11:30:06
2022-12-30 23:30:20
2022-07-25 23:10:21
2022-05-19 19:31:26
2022-08-30 07:53:57
2022-08-05 19:50:58
2022-09-19 22:15:35
2022-05-16 10:06:14
2022-09-01 22:54:44
2022-07-25 23:30:21
2022-11-07 08:42:13
2022-05-27 22:25:16
2022-02-21 15:13:20
2022-01-10 14:45:51
2022-11-07 13:05:15
2022-04-18 00:21:06
2022-02-01 03:36:17
2022-08-15 18:08:32
2022-09-16 13:50:10
2022-04-28 14:31:12
2022-07-05 19:38:29
2022-11-17 18:32:38
2022-02-16 15:35:01
2022-08-03 21:11:44
2022-06-27 10:17:27
2022-08-26 07:20:04
2022-12-21 05:08:44
2022-05-09 03:57:36
2022-02-17 22:47:28
2022-01-04 20:00:27
2022-11-28 20:06:50
2022-03-23 20:59:39
2022-08-18 08:11:47
2022-04-11 16:00:18
2022-08-25 12:17:36
2022-05-13 14:36:27
2022-10-28 03:32:08
2022-10-11 21:31:29
2022-01-28 13:55:06
2022-06-02 19:18:41
2022-02-02 23:27:27
2022-04-25 18:09:27
2022-11-08 02:41:26
2022-07-26 21:02:36
2022-04-07 17:49:34
2022-12-05 15:39:35
2022-05-02 17:56:14
2022-09-02 05:31:37
2022-09-20 13:12:42
2022-04-21 15:08:30
2022-02-10 06:24:22
2022-05-03 08:53:26
2022-03-11 17:04:41
2022-10-21 14:06:05
2022-07-06 16:15:22
2022-11-11 23:15:09
2022-06-10 23:04:28
2022-05-25 17:46:58
2022-08-22 15:22:19
2022-05-05 01:04:03
2022-04-06 16:53:30
2022-11-16 12:44:08
2022-02-18 23:10:34
2022-07-13 23:17:48
2022-04-13 07:00:35
2022-08-29 06:33:43
2022-12-13 17:16:07
2022-11-11 22:41:45
2022-04-15 10:56:49
2022-04-29 22:27:34
2022-05-12 23:04:33
2022-01-27 15:52:38
2022-05-04 07:12:02
2022-03-24 09:04:19
2022-03-18 04:38:06
2022-11-18 22:00:08
2022-03-21 12:23:03
2022-12-05 05:14:48
2022-11-23 22:04:33
2022-11-02 21:41:39
2022-01-04 17:48:39
2022-08-09 12:17:22
2022-11-09 20:03:05
2022-06-21 09:13:41
2022-09-09 10:11:37
2022-02-23 12:28:54
2022-04-11 00:48:34
2022-11-08 22:55:01
2022-10-18 16:04:48
2022-04-15 16:11:27
2022-08-10 16:19:47
2022-07-13 23:04:08
2022-05-31 16:51:45
2022-11-10 22:16:33
2022-11-09 18:23:34
2022-12-21 06:10:59
2022-04-29 21:03:33
2022-01-24 06:46:29
2022-08-12 01:41:30
2022-12-16 20:28:21
2022-09-08 23:46:13
2022-07-14 06:25:46
2022-02-25 19:03:53
2022-05-30 11:54:09
2022-07-21 03:37:23
2022-09-08 08:39:02
2022-12-12 14:02:37
2022-12-30 14:08:11
2022-09-19 23:09:26
2022-09-30 23:56:03
2022-10-25 09:50:34
2022-10-18 22:41:19
2022-12-16 21:32:30
2022-10-21 15:19:48
2022-01-17 12:10:17
2022-09-07 23:57:44
2022-07-12 14:54:28
2022-06-06 17:43:08
2022-06-16 23:14:28
2022-11-22 02:34:32
2022-03-24 11:05:21
2022-01-14 20:33:05
2022-12-06 02:59:27
2022-05-30 04:55:04
2022-01-03 06:58:15
2022-12-26 06:49:08
2022-06-08 23:20:33
2022-01-28 22:51:46
2022-07-07 19:29:31
2022-12-07 23:52:34
2022-11-29 18:47:44
2022-10-14 16:58:55
2022-03-31 19:00:22
2022-02-22 20:00:17
2022-06-28 20:16:58
2022-03-29 04:46:42
2022-08-31 22:08:12
2022-07-22 21:02:17
2022-01-25 11:30:09
2022-04-13 08:47:31
2022-05-17 20:13:18
2022-12-07 23:49:21
2022-06-09 17:41:54
2022-07-12 19:42:30
2022-03-10 02:51:01
2022-04-14 11:48:12
2022-12-01 20:50:43
2022-04-26 09:44:39
2022-04-27 18:57:56
2022-12-06 15:40:49
2022-04-22 14:02:50
2022-12-09 21:14:10
2022-09-01 17:15:27
2022-07-19 15:08:12
2022-06-20 01:25:14
2022-12-02 09:56:07
2022-04-20 20:59:03
2022-11-15 23:55:10
2022-03-31 05:58:30
2022-09-12 10:15:09
2022-03-16 23:19:39
2022-11-29 13:49:07
2022-11-15 23:21:55
2022-02-03 12:07:05
2022-05-24 20:50:42
2022-05-18 15:14:45
2022-08-15 17:28:56
2022-04-01 05:40:28
2022-07-11 17:18:24
2022-10-24 15:17:25
2022-08-16 22:19:53
2022-06-23 22:41:33
2022-08-23 23:17:36
2022-02-08 13:15:42
2022-12-14 00:48:53
2022-07-05 03:03:07
2022-06-13 19:58:57
2022-04-04 23:51:46
2022-07-27 04:41:44
2022-06-10 08:42:44
2022-03-03 13:19:50
2022-12-27 10:45:08
2022-08-23 20:53:37
2022-08-09 07:09:53
2022-01-10 21:43:49
2022-06-09 17:25:59
2022-05-10 19:41:48
2022-04-14 17:37:08
2022-11-22 16:42:47
2022-10-11 14:29:32
2022-07-26 10:03:54
2022-07-15 14:03:19
2022-06-03 19:14:30
2022-06-22 18:41:04
2022-09-30 23:56:42
2022-06-27 04:47:30
2022-05-02 14:30:50
2022-07-01 23:01:34
2022-09-29 23:08:38
2022-08-30 12:49:31
2022-10-20 23:08:14
2022-06-06 03:25:31
2022-01-13 00:04:29
2022-08-02 22:38:40
2022-08-22 17:43:12
2022-03-23 23:09:09
2022-01-19 16:21:50
2022-03-07 19:26:31
2022-09-14 20:06:57
2022-08-04 22:28:11
2022-11-04 10:31:26
2022-11-28 22:06:25
2022-03-29 06:06:41
2022-08-08 18:26:38
2022-08-05 03:07:57
2022-03-04 03:09:46
2022-10-07 22:13:24
2022-02-28 18:00:10
2022-02-14 23:51:28
2022-05-05 09:25:23
2022-11-14 14:12:10
2022-08-12 20:56:31
2022-08-11 12:43:08
2022-06-23 17:17:58
2022-04-21 17:19:35
2022-03-08 19:48:25
2022-01-13 01:17:04
2022-03-17 22:16:12
2022-11-02 20:25:33
2022-07-07 23:42:55
2022-05-19 21:04:11
2022-12-23 07:36:37
2022-06-16 14:44:26
2022-02-11 23:11:26
2022-12-08 23:00:49
2022-01-11 19:39:56
2022-12-29 17:06:27
2022-02-09 23:34:38
2022-07-18 16:18:41
2022-03-14 15:56:03
2022-12-23 04:18:49
2022-02-04 22:37:42
2022-09-14 13:51:03
2022-08-01 19:57:34
2022-11-24 18:30:16
2022-09-27 21:02:35
2022-07-29 15:55:58
2022-04-05 09:22:33
2022-09-22 21:49:32
2022-04-08 16:51:51
2022-11-30 16:07:44
2022-08-17 23:08:37
2022-11-03 23:27:53
2022-02-10 10:06:18
2022-05-13 11:32:06
2022-11-16 23:39:27
2022-05-25 03:53:40
2022-10-03 13:01:51
2022-04-19 23:37:41
2022-10-31 16:00:56
2022-06-03 17:10:15
2022-06-14 13:49:05
2022-11-01 03:42:05
2022-09-09 01:17:05
2022-07-15 21:11:31
2022-08-18 21:40:31
2022-07-04 18:52:43
2022-04-26 05:41:33
2022-12-15 20:24:29
2022-07-04 00:29:07
2022-09-29 21:05:55
2022-01-06 11:40:43
2022-04-25 22:38:51
2022-05-26 22:25:32
2022-03-09 07:20:24
2022-12-28 23:45:37
2022-12-02 16:31:45
2022-01-17 09:43:04
2022-03-02 03:46:38
2022-03-21 18:42:52
2022-02-15 23:09:59
2022-10-06 17:04:12
2022-08-16 22:04:44
2022-02-25 17:39:13
2022-08-02 03:01:20
2022-12-19 06:46:43
2022-10-20 23:47:31
2022-07-29 12:10:41
2022-01-26 14:13:20
2022-04-27 16:14:03
2022-09-20 22:20:09
2022-03-18 10:50:49
2022-10-10 06:49:10
2022-06-29 11:57:21
2022-07-21 09:58:57
2022-10-05 23:09:45
2022-11-03 23:05:58
2022-03-08 11:36:43
2022-02-21 13:42:37
2022-03-28 01:39:13
2022-12-09 00:47:56
2022-05-27 22:00:52
2022-04-01 11:57:46
2022-06-30 12:35:35
2022-03-15 21:38:06
2022-08-24 10:20:28
2022-09-22 22:48:48
2022-10-19 08:46:54
2022-08-01 18:33:43
2022-07-28 22:05:30
2022-03-04 07:47:00
2022-12-13 15:08:34
2022-10-17 23:14:50
2022-01-03 13:02:19
2022-01-12 22:00:21
2022-11-25 01:27:01
2022-11-24 17:12:42
2022-10-12 01:44:19
2022-12-19 11:07:02
2022-03-03 04:48:36
2022-03-09 09:12:23
2022-11-25 22:21:16
2022-06-20 13:36:50
2022-03-11 02:49:48
2022-08-29 08:11:52
2022-07-22 20:16:15
2022-05-10 23:17:08
2022-10-03 04:41:26
2022-02-09 18:28:29
2022-01-31 16:50:12
2022-02-04 20:52:13
2022-07-27 08:17:23
2022-01-18 19:08:53
2022-03-07 10:20:34
2022-04-18 00:31:55
2022-09-23 23:49:43
2022-04-22 20:24:36
2022-03-10 18:13:50
2022-01-07 01:43:16
2022-05-04 19:24:13
2022-06-24 02:52:50
2022-09-16 06:09:31
2022-08-10 12:35:55
2022-09-13 22:58:20
2022-11-18 19:53:14
2022-02-16 12:03:55
2022-03-22 11:40:39
2022-01-24 11:10:02
2022-09-23 23:56:40
2022-08-17 22:20:17
2022-10-13 19:53:21
2022-04-12 08:31:58
2022-07-19 18:34:37
2022-06-30 13:37:08
2022-12-20 21:57:11
2022-01-20 14:16:09
2022-10-26 20:27:36
2022-09-21 09:07:50
2022-06-17 21:39:15
2022-03-17 19:32:36
2022-02-11 19:14:03
2022-01-27 18:52:20
2022-03-01 05:13:09
2022-09-02 07:14:28
2022-11-30 21:38:26
2022-01-12 22:52:54
2022-05-26 20:00:44
2022-11-21 19:24:37
2022-03-15 12:35:12
2022-02-15 23:32:00
2022-11-04 03:06:18
2022-10-13 11:55:17
2022-10-05 23:38:34
2022-09-07 23:57:18
2022-09-06 20:03:39
2022-07-28 22:04:41
2022-10-27 17:09:22
2022-03-02 05:39:46
2022-05-20 06:38:44
2022-04-07 16:52:47
2022-08-25 21:41:12
2022-04-19 03:18:23
2022-05-18 20:20:44
2022-03-28 10:27:27
2022-01-05 12:44:08
2022-10-12 08:40:57
2022-09-15 23:57:51
2022-05-17 12:22:16
2022-09-26 23:05:46
2022-09-13 22:10:41
2022-01-25 08:12:01
2022-08-31 22:33:52
2022-10-17 23:44:04
2022-04-04 01:28:09
2022-04-05 14:04:55
2022-02-07 17:15:36
2022-09-21 02:48:17
2022-02-28 21:18:25
2022-12-22 12:05:26
2022-03-25 10:55:54
2022-10-19 00:02:26
2022-08-08 20:35:06
2022-02-24 01:21:40
2022-03-14 18:04:57
2022-06-07 22:55:57
2022-10-28 18:22:59
2022-11-01 09:57:12
2022-02-14 22:26:15
2022-03-25 16:08:18
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。