斗吟锋 提问:题目链接:1.字符统计 - 蓝桥云课 (lanqiao.cn)
问题描述:通过率只有60%
代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
// 请在此输入您的代码
char hash[26];
char str[1000000];
memset(hash, 0, sizeof(hash));
gets(str);
for (int i = 0; str[i] != '\0'; i++)
{
hash[str[i]]++;
}
int max = 0;
for (int i = 0; i < 26; i++)
{
if (hash[i] > max)
{
max = hash[i];
}
}
for (int i = 0; i < 26; i++)
{
if (hash[i] == max)
{
printf("%c", 96 + i);
}
}
return 0;
}
这个刚才回答过了:char...