字符游戏 题解:
#include <stdio.h>
int main()
{
int a[26] = {0}, n;
char c;
scanf("%d", &n);
for (int i = 0; i <= n; i++)
{
scanf("%c", &c);
a[c - 'a']++;
}
for (int i = 0; i < 26; i++)
if ((a[i] != 0) && (a[i] % 5 == 0 || a[i] % 7 == 0))
printf("%c %d\n", i + 'a', a[i]);
}
登录后发布评论
暂无评论,来抢沙发