問題一覧 > 通常問題

No.27 Preparing Boards

レベル : / AI推定難易度 : 775 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 246
作問者 : nmnmnmnmnmnmnm
お気に入りにしたユーザー ProblemId : 32 / 自分の提出
問題文最終更新日: 2026-06-25 01:05:23
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 27 (順位表) の他の問題:

Problem Statement

You can prepare an unlimited number of boards of three different lengths A, B, and C.
You may freely choose A, B, and C as integer values.
Boards can be joined together to extend their length.
You want to make boards of the specified lengths V0, V1, V2, and V3.
What is the minimum number of boards required?

Input

V0 V1 V2 V3

Four specified board lengths (V0,V1,V2,V3) are given.
They are integers with 1<=V0,V1,V2,V3<=30, and Vi=Vj (0<=i,j<=3) may hold.

Output

Output the required number of boards as a string, followed by a newline at the end.

Sample

Sample 1
Input
28 29 30 30
Output
4

One board of A=28, one board of B=29, and two boards of C=30 are needed, for a total of 4 boards.

Sample 2
Input
2 3 7 15
Output
6

Three boards of A=2, two boards of B=3, and one board of C=15 are needed, for a total of 6 boards.
7 can be made by joining two boards of A and one board of B.

Sample 3
Input
3 6 11 20
Output
5

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。