superman

聚精会神搞建设 一心一意谋发展
posts - 190, comments - 17, trackbacks - 0, articles - 0
   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

ZOJ 1099 - HTML

Posted on 2008-03-28 22:43 superman 阅读(440) 评论(1)  编辑 收藏 引用 所属分类: ZOJ
 1 /* Accepted 1099 C++ 00:00.00 840K */
 2 #include <string>
 3 #include <iostream>
 4 
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     string word;
10     int curLineLen = 0;
11     
12     while(cin >> word)
13     {
14         if(word == "<br>")
15         {
16             curLineLen = 0;
17             cout << endl;
18             continue;
19         }
20         if(word == "<hr>")
21         {
22             if(curLineLen)
23                 cout << endl;
24             for(int i = 0; i < 80; i++)
25                 cout << '-';
26             cout << endl;
27             curLineLen = 0;
28             continue;
29         }
30         if(curLineLen == 0)
31         {
32             curLineLen = word.size();
33             cout << word;
34             continue;
35         }
36         if(curLineLen + word.size() + 1 <= 80)
37         {
38             if(curLineLen)
39                 cout << ' ';
40             cout << word;
41             curLineLen += word.size() + 1;
42         }
43         else
44         {
45             curLineLen = word.size();
46             cout << endl;
47             cout << word;
48         }
49     }
50     cout << endl;
51     
52     return 0;
53 }
54 

Feedback

# re: ZOJ 1099 - HTML[未登录]  回复  更多评论   

2009-07-24 20:53 by 波波
好像没办法通过哦

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理