本地和在线IDE均可输出样例,提交后编译错误是为什么(cpp)
查看原帖
本地和在线IDE均可输出样例,提交后编译错误是为什么(cpp)
459428
85LP楼主2021/2/25 11:25

本地和在线IDE均可输出样例,提交后却编译错误,请大神指点

#include <iostream>
#include <vector>
#include <string>
#include<algorithm>
using namespace std;
bool cmp(int x,int y)
{
	return x<y;
}
int main()
{
	string str[26]={"one","two","three","four","five","six","seven",
	"eight","nine","ten","elven","twelve","thirteen","fourteen",
	"fifteen","sixteen","seventeen","eighteen","nineteen","twenty","a",
	"both","another","first","second","third"};
	int a[26]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,1,2,1,1,2,3,},b[6],l,i,m=0,targe=0;
	string s[6];
	for(i=0;i<6;i++)
		cin>>s[i];	
	for(i=0;i<6;i++)
	{
		for(l=0;l<26;l++)
		{
			if(s[i]==str[l])
			{
				b[m++]=a[l]*a[l]%100;
				targe++;
			}
		}
	}
	if(targe==0) 
	{
		cout<<"0";
		return 0;
	}
	sort(b,b+m,cmp);
	string num[6]={"0","0","0","0","0","0"},end;
	for(l=0;l<m;l++)
	{
		int x=b[l];
		if(b[l]<10)
		{
			end= to_string(x);
			if(l!=0)
			num[l]+=end;
			if(l==0)
			num[l]=end;
		}
		else num[l]=to_string(x);
	}
	string().swap(end);
	for(l=0;l<m;l++)
	{
		end+=num[l];
	}
	cout<<end;
	return 0;
}
2021/2/25 11:25
加载中...