-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3595.cpp
More file actions
50 lines (47 loc) · 1.09 KB
/
3595.cpp
File metadata and controls
50 lines (47 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 3595. 맥주 냉장고
// 2021.09.02
// 브루트 포스
#include<iostream>
using namespace std;
int main()
{
int minValue = 987654321;
int n;
cin >> n;
int ans[3] = { 0,0,0 };
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
if (i * j > n)
{
break;
}
for (int k = 1; k <= n; k++)
{
if (i * j * k > n)
{
break;
}
else if (i * j * k < n)
{
continue;
}
else
{
int size = i * j * 2 + i * k * 2 + j * k * 2;
if (size < minValue)
{
minValue = size;
ans[0] = i;
ans[1] = j;
ans[2] = k;
}
break;
}
}
}
}
cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
return 0;
}