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

请问为啥Output limit exceeded

Posted by 1374741758 at 2019-08-08 19:36:46 on Problem 3959
程序如下:
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX=2000;
vector<string> words[MAX];
vector<int> length; //每一列单词格数
int main()
{
	string s;
	int cnt=0;
	while(getline(cin,s)) //Input
	{
		stringstream ss(s);
		string str;
		int kase=1,n=0;
		while(ss>>str)
		{
			if(length.size()<kase)
			{
				length.push_back(str.length());
				kase++;
			}else{
				length[n]=max(length[n],(int)str.length());
			}
			words[cnt].push_back(str);
			n++;
		}
		cnt++;
	}
	for(int i=0;i<cnt;i++)
	{
		int len1=words[i].size();
		for(int j=0;j<len1;j++)
		{
			cout<<words[i][j];
			if(j!=len1-1)
			{
				int len2=words[i][j].length();
				for(int k=len2;k<length[j]+1;k++) //多输出一个空格
					cout<<' ';
			}
		}
		cout<<endl;
	}
	return 0;
}

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