Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 88f2530

Browse files
committed
Lv2_멀쩡한사각형
1 parent c8bd67c commit 88f2530

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <iostream>
2+
#include <algorithm>
3+
using namespace std;
4+
5+
long long solution(int w, int h)
6+
{
7+
int gcd;
8+
long long sum = (long long)w * (long long)h;
9+
10+
for (int i = (w < h) ? w : h; i > 0; i--) { //ÃÖ ́ë °ø3⁄4à1⁄4ö ± ̧Çϱâ
11+
if ((w % i == 0) && (h % i == 0)) {
12+
gcd = i;
13+
break;
14+
}
15+
}
16+
return sum - (w + h - gcd);
17+
}
18+
19+
int main() {
20+
cout << solution(8, 12);
21+
return 0;
22+
}

‎Programmers/Programmers.vcxproj‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
<ClCompile Include="Lv1\Lv1_문자열다루기기본.cpp">
5959
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
6060
</ClCompile>
61-
<ClCompile Include="Lv1\Lv1_문자열압축.cpp" />
61+
<ClCompile Include="Lv1\Lv1_문자열압축.cpp">
62+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
63+
</ClCompile>
6264
<ClCompile Include="Lv1\Lv1_문자열을정수로바꾸기.cpp">
6365
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
6466
</ClCompile>
@@ -170,6 +172,9 @@
170172
<ClCompile Include="Lv2\Lv2_라면공장.cpp">
171173
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
172174
</ClCompile>
175+
<ClCompile Include="Lv2\Lv2_멀쩡한사각형.cpp">
176+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
177+
</ClCompile>
173178
<ClCompile Include="Lv2\Lv2_소수만들기.cpp">
174179
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
175180
</ClCompile>

‎Programmers/Programmers.vcxproj.filters‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,5 +471,8 @@
471471
<ClCompile Include="Lv1\Lv1_문자열압축.cpp">
472472
<Filter>소스 파일</Filter>
473473
</ClCompile>
474+
<ClCompile Include="Lv2\Lv2_멀쩡한사각형.cpp">
475+
<Filter>소스 파일</Filter>
476+
</ClCompile>
474477
</ItemGroup>
475478
</Project>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /