个人技术分享

#include <bits/stdc++.h>
using namespace std;

 
int a[10]={13,1,2,3,5,4,4,2,2,2};
int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
 
int leap(int y){
    if((y%4==0&&y%100!=0)||y%400==0) return 1;
    return 0;
}
 
bool check(int x){
    int y=x/10000;
    int m=(x%10000)/100;
    int d=x%100;
    
    if(leap(y)==1&&m==2&&d==29) return 1;
    if(m>=1&&m<=12&&d>=1&&d<=month[m]) return 1;
    return 0;
}
 
int main(){
    int ans=0;
    for(int i=20000101;i<=20240413;i++){
        if(check(i)){
            int t=i;
            int res=0;
            while(t){
                res+=a[t%10];
                t/=10;
            }
            if(res>50){
                ans++; 
            }
        }
    }
    cout<<ans;
    return 0;
}