[姆咪] 我要吐了 教我寫c

作者: oin1104 (是oin的說)   2023-10-28 13:51:38
我要吐了
明明我寫的丟去執行都沒問題
可是就是時間太久 不接受
qsort怎麼用阿
機掰 我吐了
Description
Given a line of text you will have to find out the frequencies of the ASCII
characters present in it. The
given lines will contain none of the first 32 or last 128 ASCII characters.
Of course lines may end with
\n and \r but always keep those out of consideration.
Input
Several lines of text are given as input. Each line of text is considered as
a single input. Maximum
length of each line is 1000.
Output
Print the ASCII value of the ASCII characters which are present and their
frequency according to the
given format below. A blank line should separate each set of output. Print
the ASCII characters in the
ascending order of their frequencies. If two characters are present the same
number of times print the information
of the ASCII character with higher ASCII value first. Input is terminated by
end of file.
Sample Input 1
AAABBC
122333
Sample Output 1
67 1
66 2
65 3
49 1
50 2
51 3
這是問題
#include <stdio.h>
#include <math.h>
#include <string.h>
int main()
{
int oinnnnn=0;
char oin[1001];
int u[1][2]={{0,0}};
int y[1][2]={{0,0}};
while(gets(oin) != EOF)
{
oinnnnn = strlen(oin);
int reimu[128][2]={{0,0}};
for (int i=0; i < oinnnnn; i++)
{
int fatesn = (int)oin[i];
reimu[fatesn][0] = fatesn;
reimu[fatesn][1] ++;
}
for (int i=1; i < 128; i++)
{
for (int j=i; j >= 0 ; j
作者: a25155199 (Josh)   2023-10-28 13:52:00
私你了
作者: JIWP (JIWP)   2023-10-28 13:54:00
大師

Links booklink

Contact Us: admin [ a t ] ucptt.com