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

Re:怎会wa?

Posted by tasusparty at 2008-09-26 21:51:35 on Problem 3438
In Reply To:怎会wa? Posted by:gzw_02 at 2008-07-07 10:30:30
> # include <stdio.h>
> # include <string.h>
> char seq[1001];
> 
> int main(){
>       int i,n,len;
> 	  char pre;
> 	  scanf("%d",&n);
> 	  while(n--){
>        scanf("%s",seq);
> 	   len=strlen(seq);
> 	   pre=0;
> 	   for(i=1;i<=len;i++){
> 		  if(seq[pre]!=seq[i]){
> 	           printf("%d%c",i-pre,seq[pre]);
> 	           pre=i;
> 		   }
> 	   }
> 	   putchar('\n');
> 	  }
> 	  	return 1;
> 	}
for循环完了以后少了一句printf("%d%c",(len-pre),seq[len-1]);否则最后一个或一组相同的数字不输出。

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