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:哪位给个快点的方法啊.. 我居然3000多ms, 太丢脸了. 话说本人很懒,用stl了.

Posted by Belldandy at 2012-01-23 08:18:10 on Problem 3438
In Reply To:哪位给个快点的方法啊.. 我居然3000多ms, 太丢脸了. 话说本人很懒,用stl了. Posted by:lijinwu at 2010-04-12 18:01:20
#include<stdio.h>
int main()
{
	char temp[1500]={0},b=0;
	int i=0,n=0,k=0;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",temp);
		b=temp[0];
		k=1;
		for(i=1;temp[i];i++)
		{
			if(temp[i]==b)
			{
				k++;
			}
			else
			{
				printf("%d%c",k,b);
				b=temp[i];
				k=1;
			}
		}
		printf("%d%c\n",k,b);
	}
}

200+MS

用c吧

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