2021级《程序设计原理及C语言》练习题

Finish the definition of the following function which computes the grades of $n$ students for a course given their scores.

#include <stdio.h>
/*
Precondition:
score[]: the scores (0-100) of n (n>0) students
Postcondition:
Compute the grade ('A': 90-100; 'B': 80-89; 'C': 70-79; 'D': 60-69; 'F': 0-59)
of each student, and store the result in grade[] in the same order as in
score[]. Display the distributions of the grades including the total number
(field with=4) and the percentage (field width=8) of each grade in the following
format:
A:  30  30.00%
B:  20  20.00%
C:  20  20.00%
D:  20  20.00%
F:  10  10.00%
*/
{
}

#define MAXN 100

int main()
{
int n;
scanf("%d", &n);
int score[MAXN];
char g[MAXN];
for (int i = 0; i < n; i++)
scanf("%d", &score[i]);
}

样例

Input
10
50 60 65 70 75 80 85 90 95 100
Output
A:   3   30.00%
B:   2   20.00%
C:   2   20.00%
D:   2   20.00%
F:   1   10.00%

NaN
{"ft_lang_label":"__label__en","ft_lang_prob":0.6495254,"math_prob":0.9058592,"size":959,"snap":"2022-05-2022-21","text_gpt3_token_len":360,"char_repetition_ratio":0.12984294,"word_repetition_ratio":0.0,"special_character_ratio":0.45672575,"punctuation_ratio":0.21686748,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97135735,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-01-26T17:57:10Z\",\"WARC-Record-ID\":\"<urn:uuid:ceb4f4ef-28a7-45e5-b08c-2af59704795a>\",\"Content-Length\":\"18704\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6566d9b0-65df-452b-aade-d2ab6f2b5d53>\",\"WARC-Concurrent-To\":\"<urn:uuid:ba43f466-8e8f-4ae3-b9d9-ab7299c8b66e>\",\"WARC-IP-Address\":\"202.120.92.21\",\"WARC-Target-URI\":\"https://acm.ecnu.edu.cn/contest/480/problem/L/\",\"WARC-Payload-Digest\":\"sha1:GJZBA2SLPANCW6JTAQXDQEUJGISMPWCO\",\"WARC-Block-Digest\":\"sha1:YXW6UC4T3RUB25FZJPNDTVUWHMJMCEMK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-05/CC-MAIN-2022-05_segments_1642320304959.80_warc_CC-MAIN-20220126162115-20220126192115-00071.warc.gz\"}"}