luojunkai @ 2023-08-23 20:18:41
#include<bits/stdc++.h>
using namespace std;
long long a[5005];
bool f(int y)
{
if(y%4==0&&y%100!=0)return 1;
if(y%400==0)return 1;
return 0;
}
int main()
{
long long n,cnt=0;
scanf("%lld",&n);
for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
sort(a+1,a+n+1);
long long y1,m1,d1,h1,min1;
long long y2,m2,d2,h2,min2;
scanf("%lld-%lld-%lld-%lld:%lld",&y1,&m1,&d1,&h1,&min1);
scanf("%lld-%lld-%lld-%lld:%lld",&y2,&m2,&d2,&h2,&min2);
long long day1=d1,day2=d2;
m1--,m2--,y1--,y2--;
while(y1--)
{
if(f(y1))day1+=366;
else day1+=365;
}
while(y2--)
{
if(f(y2))day2+=366;
else day2+=365;
}
while(m1--)
{
if(m1==2){if(f(y1))day1+=29;else day1+=28;}
else if(m1==4||m1==6||m1==9||m1==11)day1+=30;
else day1+=31;
}
while(m2--)
{
if(m2==2){if(f(y2))day2+=29;else day2+=28;}
else if(m2==4||m2==6||m1==9||m1==11)day2+=30;
else day2+=31;
}
y1=(day1*24+h1)*60+min1;
y2=(day2*24+h2)*60+min2;
y2-=y1;
for(int i=1;i<=n;i++)
{
if(y2>=a[i])
{
y2-=a[i];
cnt++;
}
else break;
}
cout<<cnt;
}
by luojunkai @ 2023-08-26 08:25:24
第二个TLE了,第五个WA了
悬关
by 480624Wzh @ 2023-09-22 15:13:32
能拿80很不错了