๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm ๐Ÿง‘๐Ÿป‍๐Ÿ’ป/๋ฐฑ์ค€(BOJ)

[๋ฐฑ์ค€,c++] 14724๋ฒˆ - ๊ด€๋ฆฌ์ž๋Š” ๋ˆ„๊ตฌ?

by dkswnkk 2021. 11. 11.

๋ฌธ์ œ

 

14724๋ฒˆ: ๊ด€๋ฆฌ์ž๋Š” ๋ˆ„๊ตฌ?

PROBRAIN, GROW, ARGOS, ADMIN, ANT, MOTION, SPG, COMON, ALMIGHTY์ค‘ ๋™๋ฌธ ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ด€๋ฆฌ์ž๋กœ ์„ ๋ฐœ๋˜๋Š” ํ›„๋ณด๊ฐ€ ์†Œ์†ํ•œ ๋™์•„๋ฆฌ์˜ ์ด๋ฆ„์„ ๋Œ€๋ฌธ์ž๋กœ ์ถœ๋ ฅํ•œ๋‹ค.

www.acmicpc.net

 

์ฝ”๋“œ

#include <iostream>
#include <vector>

using namespace std;

void check(int x) {
    if (x == 1)cout << "PROBRAIN";
    if (x == 2)cout << "GROW";
    if (x == 3)cout << "ARGOS";
    if (x == 4)cout << "ADMIN";
    if (x == 5)cout << "ANT";
    if (x == 6)cout << "MOTION";
    if (x == 7)cout << "SPG";
    if (x == 8)cout << "COMON";
    if (x == 9)cout << "ALMIGHTY";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int N; cin >> N;
    int maxNum=0,result=0,maxIndex;
    for (int i = 1; i <= 9; i++) {
        for (int k = 0; k < N; k++) {
            int num; cin >> num;
            if (num > maxNum) maxNum = num;
        }
        if (maxNum>result) {
            result=maxNum;
            maxIndex = i;
        }
    }
    check(maxIndex);

}

๋Œ“๊ธ€