第一个测试数据对的上还是wrong,怎么办
查看原帖
第一个测试数据对的上还是wrong,怎么办
403563
az15777楼主2021/2/28 16:41
#include<iostream>
using namespace std;
#include <queue>
priority_queue<string,vector<string>,greater<string> >s;
int main()
{
	int m,length,i;
	string ps[100000];
	char k;
	cin>>m;
    cin.get(k);
	for(i=1;i<=m;i++)
	{
		getline(cin,ps[i]);
		
	}
    getline(cin,ps[m+1]);
    
	for(i=1;i<=m;i++)
	{
		
		if(ps[i].find(ps[m+1])==0)
		{
			
			string e;
			e=ps[i];
			s.push(e);
			
		}
		
	}
	
	while(!s.empty())
	{
		
		cout<<s.top();
		s.pop();
		if(!s.empty())
		 cout<<endl;
	}
}
2021/2/28 16:41
加载中...