写一个c语言版本吧

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

double back_gpa(int sc) {
    // the function is backing GPA to recall
    if (sc >= 90) return 4.0;
    else if (sc >= 85) return 3.7;
    else if (sc >= 82) return 3.3;
    else if (sc >= 78) return 3.0;
    else if (sc >= 75) return 2.7;
    else if (sc >= 72) return 2.3;
    else if (sc >= 68) return 2.0;
    else if (sc >= 64) return 1.5;
    else if (sc >= 60) return 1.0;
    else return 0.0;
}

int main() {
    int n;
    while (scanf("%d", &n) != EOF) {
        int *s = (int *) calloc(sizeof(int), n + 1);
        int s_all = 0;
        for (int i = 0; i < n; ++i) {
            scanf("%d", (s + i));
            // calculate the all score
            s_all += *(s + i);
        }
        double gpa_all = 0;
        for (int i = 0; i < n; ++i) {
            int sc;
            scanf("%d", &sc);
            gpa_all += back_gpa(sc) * *(s + i);
        }
        printf("%.2lf\n", gpa_all / s_all);
    }
    
    return 0;
}