__Zeze__ @ 2024-08-31 12:51:41
测评记录
#include <bits/stdc++.h>
using namespace std;
int n, a[5005], yyyy1, mm1, dd1, hh1, m1, yyyy2, mm2, dd2, hh2, m2, k, j, z = 0, l;
int main()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
scanf("%d-%d-%d-%d:%d", &yyyy1, &mm1, &dd1, &hh1, &m1);
scanf("%d-%d-%d-%d:%d", &yyyy2, &mm2, &dd2, &hh2, &m2);
k = m1 + hh1 * 60 + dd1 * (24 * 60);
j = m2 + hh2 * 60 + dd2 * (24 * 60);
for (int i = 0; i <= yyyy1; i++)
{
if ((i % 4 == 0 && i % 100 != 0) || (i % 100 == 0 && i % 400 == 0))
{
k += (366 * (24 * 60));
}
else
{
k += (365 * (24 * 60));
}
}
for (int i = 0; i <= yyyy2; i++)
{
if ((i % 4 == 0 && i % 100 != 0) || (i % 100 == 0 && i % 400 == 0))
{
j += (366 * (24 * 60));
}
else
{
j += (365 * (24 * 60));
}
}
l = 1;
while (1)
{
if (l > mm1)
{
break;
}
else if (l == 1 || l == 3 || l == 5 || l == 7 || l == 8 || l == 10 || l == 12)
{
k += (31 * (24 * 60));
}
else if (l == 2)
{
if ((yyyy1 % 4 == 0 && yyyy1 % 100 != 0) || (yyyy1 % 100 == 0 && yyyy1 % 400 == 0))
{
k += (29 * (24 * 60));
}
else
{
k += (28 * (24 * 60));
}
}
else
{
k += (30 * (24 * 60));
}
l++;
}
l = 1;
while (1)
{
if (l > mm2)
{
break;
}
else if (l == 1 || l == 3 || l == 5 || l == 7 || l == 8 || l == 10 || l == 12)
{
j += (31 * (24 * 60));
}
else if (l == 2)
{
if ((yyyy2 % 4 == 0 && yyyy2 % 100 != 0) || (yyyy2 % 100 == 0 && yyyy2 % 400 == 0))
{
j += (29 * (24 * 60));
}
else
{
j += (28 * (24 * 60));
}
}
else
{
j += (30 * (24 * 60));
}
l++;
}
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; i++)
{
k += a[i];
if (k > j)
{
break;
}
z++;
}
cout << z;
return 0;
}
by __Zeze__ @ 2024-08-31 14:05:29
@XiaoHongChong
确实
by An_OIer @ 2024-10-28 21:35:01
打破队形(
by An_OIer @ 2024-10-28 21:35:21
CSP-J RP++