알고리즘

[알고리즘] 백준 9076 - 점수 집계 (C++)

blueberrysoda 2024. 9. 18. 23:57

[문제 링크] : https://www.acmicpc.net/problem/9076

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;

    for(int i=0; i<N; i++){
        vector<int> V;
        int inp;
        for(int j=0; j<5; j++){
            cin >> inp;
            V.push_back(inp);
        }

        sort(V.begin(), V.end());

        if(V[3] - V[1] >= 4){
            cout << "KIN\n";
            continue;
        }

        int Ans = 0;
        for(int j=1; j<4; j++){
            Ans += V[j];
        }
        cout << Ans << '\n';
    }
    return 0;
}