Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求非空格的符号种类数,附简洁代码

Posted by checkoj at 2011-11-07 03:33:57 on Problem 3602 and last updated at 2011-11-07 03:36:19
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator