RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00223

Jack

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(6^{th}\) round, April \(14^{th}\), 2012

In “Blackjack”, a popular card game, the goal is to have cards which sum up to largest number not
exceeding 21. Mirko came up with his own version of this game.
In Mirko‟s game, cards have positive integers written on them. The player is given a set of cards and an
integer M. He must choose three cards from this set so that their sum comes as close as possible to M
without exceeding it. This is not always easy since there can be a hundred of cards in the given set.
Help Mirko by writing a program that finds the best possible outcome of given game.

제약
입력 형식

The first line of input contains an integer N (\(3 \le N \le 100\)), the number of cards, and M (\(10 \le M\)
300 000), the number that we must not exceed.
The following line contains numbers written on Mirko‟s cards: N distinct spa\(ce-se\)parated positive
integers less than 100 000.
There will always exist some three cards whose sum is not greater than M.

출력 형식

The first and only line of output should contain the largest possible sum we can obtain.

예제 1
입력
5 21
5 6 7 8 9
출력
21
예제 2
입력
10 500
93 181 245 214 315 36 185 138 216 295
출력
497
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2011/2012 Contest 6

평가 및 의견

Jack

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Jack

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8