159号程序员 @ 2021-08-14 20:17:00
判断闰年写了,ll开了,为啥就一个点没过呢?
by 159号程序员 @ 2021-08-14 20:17:06
#include <bits/stdc++.h>
using namespace std;
long long n, a[5005], year1, year2, month1, month2, day1, day2, h1, h2, m1, m2, ans;
long long min_;
int main()
{
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
scanf("%d-%d-%d-%d:%d", &year1, &month1, &day1, &h1, &m1);
scanf("%d-%d-%d-%d:%d", &year2, &month2, &day2, &h2, &m2);
month2 -= month1, day2 -= day1, h2 -= h1, m2 -= m1;
min_ += month2 * 43200 + day2 * 1440 + h2 * 60 + m2;
for(int i = year1; i <= year2; i++)
{
if((i % 4 == 0 && i % 400 != 0) || i % 400 == 0) min_ += i * 527040;
else min_ += i * 525600;
}
sort(a + 1, a + 1 + n);
for(int i = 1; i <= n; i++)
{
if(min_ < a[i]) break;
min_ -= a[i];
ans++;
}
cout << ans;
return 0;
}
by vincent06 @ 2021-08-16 21:07:12
(i % 4 == 0 && i % 400 != 0)
判断闰年的前面写错了吧