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

Posted by pudding110 at 2011-03-16 00:02:54 on Problem 3438
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	
	int n,data[1100],i,sum,j;
	char str[1100];
	while(scanf("%d",&n)!=EOF)
	{
		while(n--)
		{
			scanf("%s",str);
			for(i=0,j=0;i<strlen(str);i++,j+=2)
			{
				data[j+1]=str[i]-'0';sum=1;
				while(str[i]==str[i+1])
				{
					sum++;i++;
				}
					data[j]=sum;				
			}
			for(i=0;i<j;i++)
				cout<<data[i];
			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