#include <iostream> #include <string> using namespace std; int main() { int n,k; double gpa,s,credit,score; string name; bool flag = true; cin >> n; while (n--) { cin >> k; gpa = 0.0; s = 0.0; flag = true; for (int i = 1; i <= k; i++) { cin >> name >> credit >> score; gpa += credit * score; s += credit; if (60 - score >0.000001) flag = false; } gpa = gpa *1.0/ s; if (flag) printf("%.2lf\n", gpa); else printf("Sorry!\n"); if (n != 0) printf("\n"); } return 0; }
时间: 2024-10-14 00:39:15