70求助C语言

B2078 含 k 个 3 的数

LeeJC @ 2022-10-14 16:08:15

#include <stdio.h>
int main(void)
{
    long long m,j;
    int k,c=0 ;
    scanf("%d %d",&m,&k);
    int a[16],i;
    for(i=1;i<=15;i++)
    {
        int h=1;
        for(j=2;j<=i;j++)
            h*=10;
        a[i]=m/h%10;
        if(a[i]==3)
            c++;
    }
    if(k==c)
    printf("YES");
    else
    printf("NO");
    return 0;
}

by Steven_lzx @ 2022-10-14 16:11:35

scanf("%lld %d",&m,&k);


by Steven_lzx @ 2022-10-14 16:13:43

@LeeJC long long h=1;


by As_Nerve @ 2022-10-14 16:29:38

    scanf("%lld %d",&m,&k);

by riki1230 @ 2023-03-18 11:50:57

@LeeJC m是long long类型的 h得为long long


|