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

说实话,我比你还懒,第一次不小心把测试数据粘上去了,WA了,第二次重沾了一下,188Ms AC了!你看看我的代码是不是比你的还懒!

Posted by w598113636 at 2012-01-25 19:05:10 on Problem 3438
In Reply To:哪位给个快点的方法啊.. 我居然3000多ms, 太丢脸了. 话说本人很懒,用stl了. Posted by:lijinwu at 2010-04-12 18:01:20
#include<stdio.h>
#include<string.h>
char a[1010];
int main()
{
	int i,n;
	scanf("%d",&n);
	getchar();
	while(n--)
	{
		int l,i=0;
		scanf("%s",a);
		l=strlen(a);
		int m=1;
		while(i<l)
		{
			if(a[i]==a[i+1])
			{
				m++;
				i++;
			}
			else
			{
				printf("%d%c",m,a[i]);
				m=1;
				i++;
			}
		}
		putchar('\n');		
	}
return 0;
}

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