結果
問題 |
No.83 最大マッチング
|
ユーザー |
|
提出日時 | 2023-06-05 21:32:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 132 ms / 5,000 ms |
コード長 | 514 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 13,568 KB |
最終ジャッジ日時 | 2024-12-29 06:24:44 |
合計ジャッジ時間 | 1,587 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
N = int(input()) matchsticks = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6] min_matchsticks = min(matchsticks) num_digits = N // min_matchsticks remaining_matchsticks = N % min_matchsticks result = [str(matchsticks.index(min_matchsticks))] * num_digits for i in range(num_digits): for j in range(9, -1, -1): if matchsticks[j] - min_matchsticks <= remaining_matchsticks: result[i] = str(j) remaining_matchsticks -= matchsticks[j] - min_matchsticks break print("".join(result))