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:菜鸟,水过30~嘿嘿,加油~

Posted by qylsw at 2010-07-17 17:42:48 on Problem 3438
In Reply To:菜鸟,水过30~嘿嘿,加油~ Posted by:zjc0823 at 2010-04-12 16:46:22
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int x;
	cin>>x;
	while(x--){
		char s[2000];
		cin>>s;
		int a[2000],b[2000],le=strlen(s),i,j,t=0,us[2000]={0},m;
		for(i=0;i<le;i++){
			if(us[i]==1) break;
			else{
				a[t]=s[i]-'0';
				int c=0;
				for(j=i;;j++){
					if(s[j]!=s[i]) break;
					else {c++;us[j]=1;}
				}
				b[t]=c;
				i+=c-1;
				t++;
			}
		}
		for(m=0;m<t;m++) printf("%d%d",b[m],a[m]);
		cout<<endl;
	}
	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