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 |
PE,求解/************************************************************************** * Problem: POJ 2271 HTML * Copyright 2011 by Yan * DATE: * E-Mail: yming0221@gmail.com ************************************************************************/ #include <stdio.h> char word[100]; int main() { int len; int i; int cnt; int flag;/*标志上一个是不是<hr>*/ cnt=0; while(scanf("%s",word)!=EOF) { len=strlen(word); if(strcmp(word,"<br>")==0) printf("\n"),cnt=0,flag=0; else if(strcmp(word,"<hr>")==0) { if(flag==0) printf("\n"); cnt=0,printf("--------------------------------------------------------------------------------\n"); flag=1; } else { flag=0; if(cnt+len>=80) printf("\n"),cnt=0,flag=0; if(cnt!=0) printf(" "); printf("%s",word); cnt+=len+1; } } 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