是我想得太简单了吗?

B2078 含 k 个 3 的数

ewf8888 @ 2023-12-04 20:55:25

#include <stdio.h>
int main ()
{
    long long k,m,a;
    scanf("%ld %ld",&m,&k);
    a=m/3.0;
    if(a>=k)
       printf("YES");
    else 
       printf("NO");
}

by chen__pengyu @ 2023-12-16 16:16:21

@ewf8888


by kuaiCreator @ 2023-12-16 16:21:02

#include<iostream>
#include<cstdio>
using namespace std;
int main() {
    long long m,k=0;
    int g,a;
    scanf("%lld",&m);
    cin>>g;
    while(m) {
        a=m%10;
        if(a==3) {
            k++;
        }
        m=m/10;
    }
    if(k==g){
        printf("YES");
    }else{
        printf("NO");
    }
    return 0;
}

这样做的


by ewf8888 @ 2023-12-17 12:37:55

@kuai0000 谢谢


上一页 |