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

恩.把RE的直接复制再提交

Posted by Lucifer at 2005-09-27 00:29:04 on Problem 2271
In Reply To:哪两个提交?相同程序用相同语言交的? Posted by:hawk at 2005-09-26 23:21:27
RE:


#include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <memory.h>
int main()
{
        bool onespace=false;
        char ch[91];
//        freopen("in.txt","r",stdin);
        int now=0;
        while (scanf("%s",ch)==1)
        {
                if (strcmp(ch,"<br>")==0) {printf("\n"); now=0;}
                else
                if (strcmp(ch,"<hr>")==0)
                {
                        if (now!=0) printf("\n");
                       printf("--------------------------------------------------------------------------------\n");
                       // printf("--\n");
                        now=0;
                }
                else
                {
                        if (now!=0&&now+strlen(ch)+1>80) {printf("\n"); now=0;}
                        else if (now==0&&now+strlen(ch)>80) {printf("\n"); now=0;}
                        if (now==0)
                        {
                                now+=strlen(ch);
                                printf("%s",ch);
                        }
                        else
                        {
                                now+=strlen(ch)+1;
                                printf(" %s",ch);
                        }
                }
        }
        printf("\n");
        return 0;
}
//---------------------------------------------------------------------------




AC:
#include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <memory.h>
int main()
{
        bool onespace=false;
        char ch[91];
//        freopen("in.txt","r",stdin);
        int now=0;
        while (scanf("%s",ch)==1)
        {
                if (strcmp(ch,"<br>")==0) {printf("\n"); now=0;}
                else
                if (strcmp(ch,"<hr>")==0)
                {
                        if (now!=0) printf("\n");
                       printf("--------------------------------------------------------------------------------\n");
                       // printf("--\n");
                        now=0;
                }
                else
                {
                        if (now!=0&&now+strlen(ch)+1>80) {printf("\n"); now=0;}
                        else if (now==0&&now+strlen(ch)>80) {printf("\n"); now=0;}
                        if (now==0)
                        {
                                now+=strlen(ch);
                                printf("%s",ch);
                        }
                        else
                        {
                                now+=strlen(ch)+1;
                                printf(" %s",ch);
                        }
                }
        }
        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