40求助

B2078 含 k 个 3 的数

tangyiqi @ 2024-10-18 17:44:04

#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c = 0;
    scanf("%d%d",&a,&b);
    if(a%19)cout<<"NO"<<endl;
    else{
        while(a>0){
            if(a%10 == 3)c++;
            a = a/10;
        }
        if(c == b)printf("YES");
        else printf("NO");
    }
    return 0;
}

by luduoduo2023 @ 2024-10-18 17:54:28

if(a%19)cout<<"NO"<<endl;去掉70分


by imfbust @ 2024-10-18 17:56:27

开long long


by imfbust @ 2024-10-18 17:56:45

@tangyiqi


by tangyiqi @ 2024-10-18 18:01:38

@luduoduo2023 @imfbust
谢谢


|