现在的位置: 首页 > 综合 > 正文

hdu_2017字符串统计

2013年02月27日 ⁄ 综合 ⁄ 共 187字 ⁄ 字号 评论关闭

无节操水三道题,加积分,找成就感。嘿嘿。。。

#include<cstdio>
int main()
{
    int t,n;
    char s;
    scanf("%d",&t);
    getchar();

    for(int i = 0;i < t;++i)
    {
        n = 0;
        while((s = getchar())!= '\n')
        {
            if(s <='9' && s>='0') ++n;
        }
        printf("%d\n",n);
    }
    return 0;
}

抱歉!评论已关闭.