(HDOJ2017)--字符串统计
作者:互联网
字符串统计
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 134888 Accepted Submission(s): 73995
Sample Input 2 asdfasdf123123asdfasdf asdf111111111asdfasdfasdf Sample Output 6 9
#include<stdio.h>
int main(){
int n,i,num=0,length;
char str[100];
while(scanf("%d",&n)!=EOF){
for(i=0;i<n;i++){
num=0;
scanf("%s",str);
length=sizeof(str)/sizeof(char);
for(i=0;i<length;i++){
if(str[i]>=48&&str[i]<=57){
num++;
}
}
printf("%d\n",num);
}
}
}
Hanoch_Liu 发布了13 篇原创文章 · 获赞 0 · 访问量 324 私信 关注
标签:Java,Submission,int,HDOJ2017,Others,字符串,Input,统计 来源: https://blog.csdn.net/Hanoch_Liu/article/details/104121482