为什么通不过所有的测试用例啊!!!

自测得时候换了好多组数据都通过了,怎么会呢?
#include<bits/stdc++.h>
using namespace std;
int m1[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool dauh(int a){
    if(a%4==0||a%400==0&&a%100!=0) return true;
    else return false;
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int y,m,x;
    while(cin>>y>>m>>x){
    if(dauh(y)) m1[2]=29;
        else m1[2]=28;
    int date=y*10000+m*100;
    int num=0;
    for(int i=1;i<=m1[m];i++){
    int tt=date+i;
    while(tt){
        num+=(tt%10==x);
        tt/=10;
    }
}
    cout<<num<<endl;
}
    return 0;
}
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务