Skip to content

Commit

Permalink
이슈 #373에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 21, 2024
1 parent a39cef8 commit 9e7dc30
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Programmers/삼각형의_완성조건_2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <vector>
#include <algorithm>

using namespace std;

int solution(vector<int> sides) {
int answer = 0;
int longer = max(sides[0], sides[1]);
int shorter = min(sides[0], sides[1]);

answer += longer - (longer - shorter);

answer += (shorter + longer) - longer - 1;

return answer;
}

0 comments on commit 9e7dc30

Please sign in to comment.