| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
你把两个runid告诉我In Reply To:恩.把RE的直接复制再提交 Posted by:Lucifer at 2005-09-27 00:29:04 > 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator