# 11241: 【原1241】欢总的GPA

### 题目描述

author: Online Judge 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1241

01级及以后的本科毕业生：

[95,100] A+ 4.3

[90,95) A 4.0

[85,90) A- 3.7

[80,85) B+ 3.3

[75,80) B 3.0

[70,75) B- 2.7

[67,70) C+ 2.3

[65,67) C 2.0

[62,65) C- 1.7

[60,62) D 1.0

## Output Format

#include <iomanip>

double gpa;

cout << fixed << setprecision(2) << gpa;

## Sample Input

``````2
92
80
``````

## Sample Output

``````3.65
``````

## ligongzzz's solution

``````#include "iostream"
#include "cstdio"
using namespace std;

int main() {
int N;
scanf("%d", &N);

double TotalGPA = 0.0;

for (int i = 0; i < N; ++i) {
int temp;
scanf("%d",&temp);

if (temp >= 95) {
TotalGPA += 4.3;
}
else if (temp >= 90) {
TotalGPA += 4.0;
}
else if (temp >= 85) {
TotalGPA += 3.7;
}
else if (temp >= 80) {
TotalGPA += 3.3;
}
else if (temp >= 75) {
TotalGPA += 3.0;
}
else if (temp >= 70) {
TotalGPA += 2.7;
}
else if (temp >= 67) {
TotalGPA += 2.3;
}
else if (temp >= 65) {
TotalGPA += 2.0;
}
else if (temp >= 62) {
TotalGPA += 1.7;
}
else if (temp >= 60) {
TotalGPA += 1.0;
}
}

printf("%.2f", TotalGPA / N);

return 0;
}
``````

## skyzh's solution

``````#include <iostream>
#include <iomanip>

using namespace std;

int main() {
int SCORE_MAP[101] = { 0 };
for (int i = 60; i < 62; i++) SCORE_MAP[i] = 10;
for (int i = 62; i < 65; i++) SCORE_MAP[i] = 17;
for (int i = 65; i < 67; i++) SCORE_MAP[i] = 20;
for (int i = 67; i < 70; i++) SCORE_MAP[i] = 23;
for (int i = 70; i < 75; i++) SCORE_MAP[i] = 27;
for (int i = 75; i < 80; i++) SCORE_MAP[i] = 30;
for (int i = 80; i < 85; i++) SCORE_MAP[i] = 33;
for (int i = 85; i < 90; i++) SCORE_MAP[i] = 37;
for (int i = 90; i < 95; i++) SCORE_MAP[i] = 40;
for (int i = 95; i <= 100; i++) SCORE_MAP[i] = 43;
long long sum = 0;
int N;
cin >> N;
int tmp;
for (int i = 0; i < N; i++) {
cin >> tmp;
sum += SCORE_MAP[tmp];
}
cout << fixed << setprecision(2) << (double) sum / N / 10.0 << endl;
return 0;
}
``````