70,求助!

B2078 含 k 个 3 的数

ammdyc @ 2022-10-14 10:33:12


#include<bits/stdc++.h>
using namespace std;
long long n,m;
string s;
int main(){
    cin>>s;
    cin>>n;
    for(long long i=1;i<=s.length();i++){
        if(s[i]=='3'){
            m++;
        }
    }
    if(m==n){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
    return 0;
} 

by xingke233 @ 2022-10-14 10:40:15

@ammdyc

string 下标从0开始


by ammdyc @ 2022-10-14 10:43:25

@@xingke233 谢谢


|