数据卡了下不下来有谁看看什么错?答案错误?玄学??

P1167 刷题

suzhibin @ 2018-05-09 15:42:12

include<iostream>

include<stdio.h>

include<algorithm>

include<cstdio>

include<string.h>

include<cstring>

using namespace std; int rn(int a,int b) { int s=0; for(int i=a;i<=b;i++) if(i%4==0&&i%100!=0||i%400==0)s++; return s; } bool p(int i) { if(i%4==0&&i%100!=0||i%400==0)return true; return false; } int main() { int d[2][13]={{0,31,28,31,30,31,30,31,31,30,31,31,30}, {0,31,29,31,30,31,30,31,31,30,31,31,30}}; int a[5005]; int a1,a2,a3,a4,a5,b1,b2,b3,b4,b5; int n; cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; sort(a+1,a+1+n); scanf("%d-%d-%d-%d:%d",&a1,&a2,&a3,&a4,&a5); scanf("%d-%d-%d-%d:%d",&b1,&b2,&b3,&b4,&b5); long long s1=525600; long long s2=527040; long long sum=rn(a1,b1-1)s2+(b1-a1-rn(a1,b1-1))s1; long long sum1=1440-(a460+a5); a3--; long long sum2=1440-(b460+b5); b3--; for(int i=1;i<a2;i++) { if(p(a1)) { sum1+=1440(d[1][i]); } else sum1+=1440(d[0][i]); } sum1+=1440a3; //cout<<sum1; for(int i=1;i<b2;i++) { if(p(b1)) sum2+=1440(d[1][i]); else sum2+=1440(d[0][i]); } sum2+=1440b3; // cout<<endl<<sum2; long long total=sum+sum1-sum2; // cout<<total<<endl; long long ss=0;int ii; for(int i=1;i<=n;i++) { ss+=a[i]; if(ss>total){cout<<i-1; return 0; } ii=i; } if(ss>total&&n==1){cout<<'0';return 0;} cout<<ii; return 0; }


by Planet6174 @ 2018-05-09 16:25:39

这样没人看的


by C6H14 @ 2019-06-06 13:37:09

希望更丰富的展现?使用Markdown


by Hooxi @ 2019-08-08 08:51:00

the11 12month should be swaped


|