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

确实,c可以,c++就不行,while(cin)就超时,while(scanf)就能过

Posted by 2004140022 at 2015-10-21 09:55:23 on Problem 1750
#include<stdio.h>
#include<string.h>
#define N 11
int main()
{
    char s[N],p[N];
    int t,i;
    t=0;
    strcpy(p,"-1");
    while(scanf("%s",s)!=EOF)
    {
        for(i=0;i<t+1&&i<strlen(s)&&i<strlen(p);i++)
            if(s[i]!=p[i])break;
        t=i;
        for(i=0;i<t;i++)
            printf(" ");
        printf("%s\n",s);
        strcpy(p,s);
    }
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