結果

問題 No.91 赤、緑、青の石
ユーザー zombietan
提出日時 2016-05-16 14:54:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 694 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-24 06:58:08
合計ジャッジ時間 2,036 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

r,g,b = map(int, input().split())
s = sorted([r,g,b])
c = 0
if s[0] != 0:
    a = min(s)
    s = [0, s[1]-a, s[2]-a]
    c = a

if s[1] >= 1 and s[2] >= 3:
    sa = s[2] - s[1]
    x, y = divmod(sa, 2)
    if x <= s[1]:
        c = c + x
        s[1] = s[1] - x
        s[2] = s[2] - (3*x)
        if s[1] == s[2]:
            k, j = divmod(s[1], 4)
            c = c + k*2 + j//3
            print(c)
            exit()
        else:
            k, j = divmod(s[1], 4)
            c = c + k*2 + j//2
            print(c)
            exit()
    else:
        while s[1] >= 1 and s[2] >= 3:
            s[2] -=  3
            s[1] -=  1
            c += 1
        
d = s[2]//5
c = c + d
print(c)
0