TiAmo_TerSempre @ 2023-08-07 14:09:36
#include <bits/stdc++.h>
using namespace std;
char n[100];
long long k,cnt;
int main(){
cin>>n>>k;
for(int i=0;i<strlen(n);i++){
if(n[i]=='3') cnt++;
}
if(cnt>=k){
cout<<"YES";
}else{
cout<<"NO";
}
return 0;
}
by CultReborn @ 2023-08-07 14:13:04
注意:恰好
#include <bits/stdc++.h>
using namespace std;
char n[100];
long long k,cnt;
int mian(){
cin>>n>>k;
for(int i=0;i<strlen(n);i++){
if(n[i]=='3') cnt++;
}
if(cnt==k){
cout<<"YES";
}else{
cout<<"NO";
}
return 0;
}
by TiAmo_TerSempre @ 2023-08-07 14:14:00
谢谢
by qinshi0308 @ 2023-08-07 14:17:45
判断
m 是否恰好含有k 个3
所以第 if
内应是 cnt==k
而不是 cnt>=k
。
by Huangziyu2022 @ 2023-08-13 11:41:10
int main()
by Huangziyu2022 @ 2023-08-13 11:41:29
@CultReborn
by CultReborn @ 2023-08-14 08:05:42
@Huangziyu2022 故意的,你复制粘贴了吧
by Huangziyu2022 @ 2023-08-14 20:07:23
@CultReborn 没有,这种水题没必要