果然是著名的无聊题,最后一行要换行,害我PE了两下才发现。简单的模拟处理HTML//2008-01-13 17:41:07 Accepted 1099 C++ 00:00.00 392K #include<stdio.h> #include<string.h> int main() { freopen("1099.txt","r",stdin); char word[30]; int count=0,tc; while(scanf("%s",word)!=EOF) { tc = strlen(word); if(word[0]=='<') { if(word[1]=='b') { printf("/n"); count=0; } if(word[1]=='h') { if(count!=0) printf("/n"); printf("--------------------------------------------------------------------------------/n"); count=0; } } else { if(count+1+tc<=80) { if(count==0) { printf("%s",word); count += tc; } else { printf(" %s",word); count += 1+tc; } } else { printf("/n%s",word); count=tc; } } } printf("/n"); fclose(stdin); return 0; }