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

1125MS,究竟测试数据有多庞大?

Posted by niuzheng168 at 2009-07-19 01:17:46 on Problem 3438
#include <stdio.h>
#include <string.h>
int main()
{
	char s[1001];
	int t,i,num=1,len;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%s",s);
		len=strlen(s);
		for(i=1;i<=len;i++)
		{
			if(s[i]==s[i-1])
				num++;
			else
			{
				printf("%d%c",num,s[i-1]);
				num=1;
			}
		}
		printf("\n");
	}
	return 0;
}

O(N)都要1125MS了、、、

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