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 416221843 at 2017-04-27 20:23:28 on Problem 3438
题目看着一句就行:For example, the string 122344111 can be described as "one 1, two 2's, one 3, two 4's, three 1's". 
#include<cstdio>
char a[1005];
int i, s, k,t;
int main()
{
	scanf("%d", &t);
	while (t--&&scanf("%s", a))
	{
		k = 0, i = 1;
		while (a[++k])
			if (a[k] == a[k - 1]) i++;
			else printf("%d%c", i, a[k - 1]), i = 1;
			printf("%d%c\n", i, a[k - 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