标签:
直接看sample input = =
又一道模拟。
1 #include <iostream> 2 #include <string> 3 #include <cstdio> 4 using namespace std; 5 string s; 6 int main() 7 { 8 // freopen("date.out","w",stdout); 9 int m=0; 10 while(cin>>s) 11 { 12 if(s=="<br>") 13 { 14 cout<<endl; 15 m=0; 16 } 17 else if(s=="<hr>") 18 { 19 if(m!=0) 20 { 21 cout<<endl; 22 m=0; 23 } 24 cout<<string(80,‘-‘)<<endl; 25 } 26 else 27 { 28 if(m+s.length()+1>80) 29 { 30 cout<<endl; 31 m=0; 32 } 33 if(m) 34 { 35 cout<<‘ ‘; 36 m++; 37 } 38 cout<<s; 39 m+=s.length(); 40 if(m>=80) 41 { 42 cout<<endl; 43 m=0; 44 } 45 } 46 } 47 cout<<endl; 48 }
HDU 1088 - Write a simple HTML Browser
标签:
原文地址:http://www.cnblogs.com/nicetomeetu/p/5582425.html