Dankingzzz @ 2024-10-28 17:51:49
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int get_number(const char* word)
{
if (strcmp(word, "one") == 0) return 1;
if (strcmp(word, "two") == 0) return 2;
if (strcmp(word, "three") == 0) return 3;
if (strcmp(word, "four") == 0) return 4;
if (strcmp(word, "five") == 0) return 5;
if (strcmp(word, "six") == 0) return 6;
if (strcmp(word, "seven") == 0) return 7;
if (strcmp(word, "eight") == 0) return 8;
if (strcmp(word, "nine") == 0) return 9;
if (strcmp(word, "ten") == 0) return 10;
if (strcmp(word, "eleven") == 0) return 11;
if (strcmp(word, "twelve") == 0) return 12;
if (strcmp(word, "thirteen") == 0) return 13;
if (strcmp(word, "fourteen") == 0) return 14;
if (strcmp(word, "fifteen") == 0) return 15;
if (strcmp(word, "sixteen") == 0) return 16;
if (strcmp(word, "seventeen") == 0) return 17;
if (strcmp(word, "eighteen") == 0) return 18;
if (strcmp(word, "nineteen") == 0) return 19;
if (strcmp(word, "twenty") == 0) return 20;
if (strcmp(word, "a") == 0) return 1;
if (strcmp(word, "both") == 0) return 2;
if (strcmp(word, "another") == 0) return 1;
if (strcmp(word, "first") == 0) return 1;
if (strcmp(word, "second") == 0) return 2;
if (strcmp(word, "third") == 0) return 3;
return 0;
}
int main()
{
int count = 0;
char str[1000];
int a[1000];
fgets(str, 1000, stdin);
char ch = ' ';
str[strlen(str)] = ch;
char* word = strtok(str, " ");
while (word != NULL && count < 6)
{
int num = get_number(word);
if (num > 0)
{
a[count++] = num * num % 100;
}
word = strtok(NULL, " ");
}
if (count == 0)
{
printf("0\n");
return 0;
}
for (int i = 0; i < count - 1; i++)
{
for (int j = i + 1; j < count; j++)
{
if (a[i] > a[j])
{
int temp = a[j];
a[j] = a[i];
a[i] = temp;
}
}
}
int password = 0;
for (int i = 0; i < count; i++)
{
password = password * 100 + a[i];
}
while (password >= 100 && password % 100 == 0)
{
password /= 100;
}
printf("%d\n", password);
return 0;
}
```就第四组数据过不了怎么办请求
by DENGZIAO @ 2024-10-28 18:12:10
dank1ng怎么来了(?
by Dankingzzz @ 2024-10-30 00:56:32
@DENGZIAO 来打icpc
by DENGZIAO @ 2024-10-30 08:29:47
@Dankingzzz 全场欢呼dank1ng !dank1ng !dank1ng !