No.83 Maximum Matching
レベル :
/ AI推定難易度 : 525
/ 実行時間制限 : 1ケース 5.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 971
作問者 :
sugim48
タグ : / 解いたユーザー数 971
作問者 :
sugim48
問題文最終更新日: 2026-06-25 07:00:54
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 60
(順位表)
の他の問題:
Problem Statement
You are working on a famous problem called the "Maximum Matching Problem".
In this problem, given some matchsticks, you are to find the largest number that can be represented by arranging them.
A number is represented by placing digits from $0$ to $9$ side by side.
The digits are represented as shown in the figure below.
You must not break the matchsticks, but you do not need to use all of them.
Given $N$ matchsticks, find the largest number that can be represented by arranging them.
Input
$N$
The number of matchsticks $N(2\leq N\leq10^5)$ is given.
Output
Output the largest number that can be represented by arranging the matchsticks.
Print a newline at the end.
Sample
Sample 1
Input
2
Output
1
Sample 2
Input
3
Output
7
Sample 3
Input
4
Output
11
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。