BOJ 14215 세 막대

1 개요[ | ]

BOJ 14215 세 막대


2 C++[ | ]

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

int getLongest(int a, int b, int c) {
    int arr[3] = {a,b,c};
    sort(arr, arr+3);
    return arr[0] + arr[1]+ min(arr[0]+arr[1]-1, arr[2]);
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << getLongest(a, b, c) << '\n';
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}