HDOJ2017 ( 字符串统计 ) 【水题】

Problem : 2017 ( 字符串统计 )     Judge Status : Accepted
RunId : 6000218    Language : C    Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
 1 #include <stdio.h>
 2 int main()
 3 {
 4     int cnt,i,n;
 5     char str[1000];
 6     scanf("%d",&n);
 7     while (n--)
 8     {
 9         cnt=0;
10         scanf("%s",str);
11         i=0;
12         while (str[i]!='\0')
13         {
14             if(str[i]<='9'&&str[i]>='0')
15                 cnt++;
16             i++;
17         }
18         printf("%d\n",cnt);
19     }
20     return 0;
21 }

 

posted @ 2012-05-26 00:07  ZH奶酪  阅读(396)  评论(0编辑  收藏  举报