0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 04:51:59 +00:00

P1167 刷题

R52536339
This commit is contained in:
Baoshuo Ren 2021-07-07 11:46:37 +08:00 committed by Baoshuo Ren
parent e1c2bc3a9e
commit b7e8f89065
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,32 @@
#include <bits/stdc++.h>
using namespace std;
time_t getTime() {
tm t;
scanf("%d-%d-%d-%d:%d", &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min);
t.tm_year -= 1900;
t.tm_mon -= 1;
t.tm_isdst = t.tm_sec = 0;
return mktime(&t);
}
int main() {
time_t time_start, time_end, time_left;
int n, a[5005], ans = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
time_start = getTime();
time_end = getTime();
time_left = (time_end - time_start) / 60;
sort(a, a + n);
for (int i = 0; i < n; i++) {
time_left -= a[i];
if (time_left < 0) break;
ans++;
}
cout << ans << endl;
return 0;
}