| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
求非空格的符号种类数,附简洁代码char *table[7]={"ffi","ffl","fi","fl","ff","``","\'\'"};
int use[155];
char buf[10005];
int main()
{
use[' ']=1;
int ans=0,i;
while(gets(buf))
{
for(char *p=buf;*p;)
{
for(i=0;i<7;i++)if(strncmp(table[i],p,strlen(table[i]))==0)break;
if(i<7)p+=strlen(table[i]);
else i=*p++;
if(!use[i]){use[i]=1;ans++;}
}
}
printf("%d\n",ans);
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator