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

100纪念题 留个印 贴个码,挺简洁,但时间长,不知WHY

Posted by qiuzhenqiu at 2010-08-05 16:25:45
#include <stdio.h>
#include<string.h>
int main(int argc, char *argv[])
{
    char str[1005],temp,temp1;
    char str1[1005];
    int n,i,j,sum;
    int stop;
    scanf("%d",&n);
    getchar();
    for(i=0;i<n;i++)
    {
        gets(str);
        temp=str[0];
        sum=1;
        stop=1;
        temp1=temp;
        for(j=1;j<strlen(str);j++)
        {
             if(str[j]==temp)
             {sum++;stop=sum;temp1=temp;}
             else
             {
                sum=1;temp=str[j];
                printf("%d%c",stop,temp1);
                stop=1;
                temp1=str[j];
             }
        }
        printf("%d%c",stop,temp1);
        printf("\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