2017 字符串统计(杭电)

//
//  main.c
//  杭州电子科技大学
//
//  Created by yonuyeung on 2021/10/12.
//
#include<stdio.h>
int main()
{
    int n;
    char c;
    scanf("%d",&n);
    getchar();      //吸收输入n后的\n
    while(n--)
    {
        int count=0;
        while((c=getchar())&&(c!='\n'))     //像这种逻辑运算一定要用()把相应的公式括起来!
        {
            if(c>='0'&&c<='9') count++;     //具体请见ASCII
        }
        printf("%d\n",count);
    }
    return 0;
}

上一篇:多线程


下一篇:浅谈超快读