문제 링크 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5PwGK6AcIDFAUq


문제의 저작권은 SW Expert Academy에 있습니다.



#include <iostream>
 
using namespace std;
 
int main(void) {
    string grade[10= {"A+""A0""A-""B+""B0""B-""C+""C0""C-""D0"};
    int T, N, K;
    cin >> T;
 
    for(int t_case=0; t_case<T; t_case++) {
        cin >> N >> K;
        float score[N], temp;
 
        for(int i=0; i<N; i++) {
            score[i] = 0;
            cin >> temp;
            score[i] += temp * 0.35;
            cin >> temp;
            score[i] += temp * 0.45;
            cin >> temp;
            score[i] += temp * 0.20;
        }
 
        int cnt = 0;
 
        for(int i=0; i<N; i++) {
            if((score[i] > score[K-1]) & (i != K-1)) {
                cnt++;
            }
        }
 
        cout << "#" << t_case+1 << " " << grade[(cnt)/(N/10)] << "\n";
    }
 
    return 0;
}
cs

+ Recent posts