40分,大佬帮帮我!!!!!!!

B2078 含 k 个 3 的数

nuoxi6868 @ 2023-07-24 23:00:20


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,e,w=0,r,q=0;
    cin>>a>>b;
    e=a;
    while(e>0){
        e=e/10;
        w++;
    }
    for(int i=1;i<=w;i++){
        r=a%10;
        if(r==3)q++;
        a/=10;
    }
    if(q==3)cout<<"YES";
    else
        cout<<"NO";
    return 0;
}

by Misophiliac @ 2023-07-24 23:05:28

@nuoxi6868

if(q==3)cout<<"YES";->if(q==b)cout<<"YES";


by nuoxi6868 @ 2023-07-24 23:07:54

谢谢大佬


by nuoxi6868 @ 2023-07-24 23:09:24

关注了


|