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 asd1234ac at 2009-02-18 16:16:52 on Problem 3438
#include <stdio.h>
#include <string.h>
#define SIZE 1001
int main()
{
    int i, count;
    int cases;
    char in[SIZE];
    scanf("%d", &cases);
    while(cases--)
    {
        scanf("%s", in);
        for(i = 0, count = 1; i < (strlen(in) - 1); i++)
        {
            if(in[i] == in[i + 1])
                count++;
            else
            {
                printf("%d%d", count, in[i] - 48);
                count = 1;
            }
        }
        printf("%d%d\n", count, in[i] - 48);
    }
    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