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

gets( ) WA , cin AC 为什么呢?嚎

Posted by arunabao at 2009-08-21 11:32:53 on Problem 3438
#include <iostream>
using namespace std;
int main()
{	
    int n1,i,j;char c[1000],p;
	cin>>n1;
	for(int k=0;k<n1;k++)
	{
		cin>>c;/////改成gets就WA
		j=1;
		for(i=1,p=c[0];i<strlen(c);i++)
			if(c[i]==p)
				j++;
			else
			{
				cout<<j<<(int)p-48;
			    j=1;
		     	p=c[i];
			}
        cout<<j<<(int)p-48<<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