Skip to content

Commit 406675a

Browse files
committed
[BOJ] 블랙잭 / 브론즈 2 / 40분
https://www.acmicpc.net/problem/2798
1 parent 3415411 commit 406675a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
n,m = map(int,input().split())
3+
4+
arr = list(map(int,input().split()))
5+
6+
arr.sort(reverse=True)
7+
num = 3
8+
9+
result = m
10+
answer = 0
11+
12+
for i in range(n):
13+
for j in range(i+1,n):
14+
for k in range(j+1,n):
15+
if arr[i]+arr[j]+arr[k] <= m:
16+
answer = max(answer,arr[i]+arr[j]+arr[k])
17+
break
18+
19+
print(answer)

0 commit comments

Comments
 (0)