求助dalao
查看原帖
求助dalao
399062
星宿未泯楼主2021/6/29 19:05

运行不出来,说10行16列,有问题.找了很久也没有找到,求助dalao

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char a[101];
	scanf("%s",a[101]);
	int l=strlen(a),t[l];
	const int z[25]{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
	for(int i=0;i<l;i++)
	{
		for(int j=1;j<l;j++)
		{
			if(a[i]==a[j])
				t[i]++;
		}
	}
	int	b=0,s=1000;
	for(int i=0;i<l;i++)
	{
		if(b<t[i])
			b=t[i];
		if(s>t[i])
			s=t[i];
	}
	for(int i=0;i<25;i++)
	{
		if((b-s)==z[i])
		{
			cout<<"Lucky Word"<<endl<<b-s;
			return 0;
		}
		else
		{	
			cout<<"No Answer"<<0;
			return 0;
		}
	}
	return 0;
}
2021/6/29 19:05
加载中...