PersonalCorpus 版 (精华区)
寄信人: sino (茶水)
标 题: 494
发信站: 哈工大紫丁香 (2002年06月16日17:44:38 星期天)
来 源: 202.118.239.224
Your C++ program has solved Ok the problem 494 (Kindergarten Counting
Game)
in 0.000 seconds with low memory spent.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <ctype.h>
void main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\uva\\input494.txt","r",stdin);
freopen("c:\\uva\\output494.txt","w",stdout);
#endif
char s[1000];
int i,sum;
while (gets(s)!=NULL) {
sum=0;
for (i=0;i<strlen(s);i++) {
while ((i<strlen(s))&&(!isalpha(s[i]))) i++;
if (i==strlen(s)) break;
sum++;
while ((i<strlen(s))&&(isalpha(s[i]))) i++;
}
printf("%d\n",sum);
}
}
--
SecureNetTerm can be dowloaded to all countries except
Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria.
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.239.224]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:4.117毫秒