其他分享
首页 > 其他分享> > P1980 [NOIP2013 普及组] 计数问题

P1980 [NOIP2013 普及组] 计数问题

作者:互联网

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char num[10];
int main()
{
    int n, x;
    while(scanf("%d %d", &n, &x) != EOF)
    {
        int kase = 0;
        for(int i = 1; i <= n; i++)
        {
            int temp = i;
            while(temp > 0)
            {
                if(temp%10 == x)
                {
                    kase++;
                }
                temp = temp/10;
            }
        }
        printf("%d\n", kase);
    }
    return 0;
}

 

标签:10,main,NOIP2013,temp,int,P1980,kase,计数问题,include
来源: https://www.cnblogs.com/White-Raffard/p/15465152.html