__T_T__ @ 2023-05-01 14:38:15
#include<bits/stdc++.h>
using namespace std;
int main(){
unsigned long long n,k,sum=0;
cin>>n>>k;
while(n!=0){
if(n%10==3){
sum++;
}
n/=10;
}
puts(sum>=k?"YES":"NO");
return 0;
}
by midsummer_zyl @ 2023-06-27 21:41:16
@____6____
注意读题:
题目要求是sum == k
所以代码如下:
#include<bits/stdc++.h>
using namespace std;
int main(){
unsigned long long n, k, sum = 0;
cin >> n >> k;
while (n != 0) {
if(n % 10 == 3) {
sum++;
}
n/=10;
}
puts(sum==k?"YES":"NO"); // 将“>= ”改为 “== ”
return 0;
}
by midsummer_zyl @ 2023-06-27 21:42:06
@____6____
点个关注呗!
by __T_T__ @ 2023-07-04 12:03:17
@midsummer_zyl 点了