比这篇新的文章:
Codee#2612
比这篇旧的文章: Codee#2610
作者: , 点击61次, 评论(0), 收藏者(0), , 打分:
所有评论,共0条:( 我也来说两句)
比这篇旧的文章: Codee#2610
Codee#2611 编辑代码
语言: C++, 标签: 无 2009/07/02发布 8个月前更新 | 编辑代码作者: , 点击61次, 评论(0), 收藏者(0), , 打分:
C++语言: Codee#2611
01 #include<iostream>
02 #include<string>
03 using namespace std;
04
05 int main()
06 {
07 freopen("BAIDU.html","w",stdout);
08 char c;
09 string s;
10 bool b=0,tu=0,once=1;
11 int ans=0;
12 while((c=getchar())!=EOF)
13 {
14 if(c=='\n')
15 continue;
16 if(c=='>')
17 {
18 s+='>';
19 b=0;
20 if(s=="</DIV>")
21 ans++;
22
23 if(tu)
24 {
25 if(s[1]=='D'&&s[2]=='I'&&s[3]=='V')
26 ans++;
27 }
28
29 if(ans==1)
30 tu=1;
31 else if(ans==2)
32 {
33 cout<<s;
34 if(once)
35 {
36 once=0;
37 cout<<"<html><body><basefont face=\"Fixedsys\">";
38 }
39 }
40 else if(ans==3)
41 {
42 cout<<"</body></html>"<<s<<endl;
43 break;
44 }
45
46 }
47
48 if(b)
49 {
50 s+=c;
51 }
52 else if(tu&&c!='<'&&c!='>')
53 {
54 cout<<c;
55 }
56
57 if(c=='<')
58 {
59 b=1;
60 s="<";
61 }
62 }
63 return 0;
64 }
02 #include<string>
03 using namespace std;
04
05 int main()
06 {
07 freopen("BAIDU.html","w",stdout);
08 char c;
09 string s;
10 bool b=0,tu=0,once=1;
11 int ans=0;
12 while((c=getchar())!=EOF)
13 {
14 if(c=='\n')
15 continue;
16 if(c=='>')
17 {
18 s+='>';
19 b=0;
20 if(s=="</DIV>")
21 ans++;
22
23 if(tu)
24 {
25 if(s[1]=='D'&&s[2]=='I'&&s[3]=='V')
26 ans++;
27 }
28
29 if(ans==1)
30 tu=1;
31 else if(ans==2)
32 {
33 cout<<s;
34 if(once)
35 {
36 once=0;
37 cout<<"<html><body><basefont face=\"Fixedsys\">";
38 }
39 }
40 else if(ans==3)
41 {
42 cout<<"</body></html>"<<s<<endl;
43 break;
44 }
45
46 }
47
48 if(b)
49 {
50 s+=c;
51 }
52 else if(tu&&c!='<'&&c!='>')
53 {
54 cout<<c;
55 }
56
57 if(c=='<')
58 {
59 b=1;
60 s="<";
61 }
62 }
63 return 0;
64 }
所有评论,共0条:( 我也来说两句)
代码
