37分,紧急求助大神!!!

P2010 [NOIP2016 普及组] 回文日期

leoduo @ 2021-07-13 21:12:28

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

int main(){
    int a[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    int date1,date2,n=1,sum=0,num=0;
    long long d[367]={0};
    cin>>date1>>date2;
    for(int i=1;i<=12;i++){
        for(int j=1;j<=a[i];j++){
            sum=i*100+j;
            d[n]=(sum%10*1000+sum%10*10+sum/10%10+sum/1000%10)*10000+sum;
            n++;
            if(d[n]>=date1&&d[n]<=date2){
                num++;
            }
        }
    }
    cout<<num;
    return 0;
}

by leoduo @ 2021-07-14 11:32:33

代码太丑了,求帮助!!!! 我急用!!!!!!!!!!!!! 谢谢各位大神,求速回复!!!!!!


by Ryan_jiang07 @ 2021-07-26 20:07:32

过了十几天还是没人回复的样子(╯▽╰)


by leoduo @ 2021-08-10 16:45:35

@Ryan_jiang07 你咋不回复呢,还说别人!


by Andy_L @ 2021-08-18 11:20:12

提示:2月份的考虑没?


|