[CodeUp] #4501-백설공주와 난장이(정올 1번 수준 문제)

chrmqgozj·2022년 1월 21일
0

CodeUp

목록 보기
12/48
#include <iostream>
#include <algorithm>
using namespace std;
int arr[7];

int compare(int a, int b){
    return a>b;
}

int main(){
    for(int i=0;i<7;i++){
        cin >> arr[i];
    }
    sort(arr,arr+7,compare);

    int max1 = arr[0];
    int max2 = arr[1];
    if(max1 == max2){
        cout << max1 << " " << max2;
    }
    else{
        cout << max1 << "\n" << max2;
    }

}

0개의 댓글

관련 채용 정보