这为什么RE!!!
查看原帖
这为什么RE!!!
1148832
LabmemNo_012LzTopic楼主2024/7/19 10:33
#include<stdio.h>
#include<string.h>
#include<math.h>
//1,4,9,16,25,36,49,64,81,21,44,69,96,25,56,89,24,61,0
char str[20][25] = {"one","two","three","four","five",
                    "six","seven","eight","nine","ten",
                    "eleven","twelve","thirteen","fourteen","fifteen",
                    "sixteen","seventeen","eighteen","nineteen","twenty"};

int query(char* s)
{
	for (int i = 0; i < 20; i++)
	{
		if (strcmp(s, str[i]) == 0)
		{
			int x = pow(i + 1, 2);
			x = x % 100;
			return x;
		}
	}
	return 0;
}

int main()
{
	char c,s[15];
	int a[100] = { 0 },index=0;
	while ((c = getchar()) != '\n')
	{
		if (c == ' ' || c == '.')
		{
			s[index] = '\0';
			a[query(s)]++;
			index = 0;
		}
		else s[index++] = c;
	}
	int f=1;
	for (int i = 1; i <= 96; i++)
	{
		if (a[i])
		{
			f = 0;
			printf("%d", i);
		}
	}
	if (f)printf("0");
	return 0;
}
2024/7/19 10:33
加载中...