Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

PE死了

Posted by zyz at 2008-02-25 12:11:20 on Problem 2271
#include<iostream>
#include<string>
using namespace std;

int main(){
	string input;
	int curlen = 0;
	string hr(80,'-');
	while(cin>>input){
		if(input=="<br>"){ curlen=0; cout<<endl;}
		else if(input=="<hr>"){ if(curlen) cout<<endl; curlen=0; cout<<hr<<endl;}
		else if(curlen==0){
			cout<<input; curlen+=input.length();
		}else{
			if(curlen+1+input.length()>80){
				cout<<endl<<input; curlen=input.length();
			}
			else
				cout<<" "<<input; curlen+=input.length()+1;
		}
	}
	cout<<endl;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator