zp1099.cpp
来自「浙江大学acm在线判题器代码集。 本人在浙大acm判题器上的所有代码(心血) 」· C++ 代码 · 共 29 行
CPP
29 行
#include <iostream>
#include <string>
//#include <fstream>
using namespace std;
string word;
int word_l,poi;
int main()
{//ifstream cin("input.txt");
//ofstream cout("output.txt");
poi=0;word="";
while(cin>>word)
{word_l=word.length();
if(word=="<br>"){cout<<endl;poi=0;}
if(word=="<hr>")
{if(poi!=0)cout<<endl;
for(int i=1;i<=80;i++)cout<<"-";
cout<<endl;
poi=0;
}
if(word!="<br>" && word!="<hr>")
{if(poi==0){cout<<word;poi=word_l;}
else
if(poi>0 && poi+word_l+1<=80){cout<<" "<<word;poi+=word_l+1;}
else
if(poi>0 && poi+word_l+1> 80){cout<<endl<<word;poi=word_l;}
}
}
cout<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?