提出 #31064280


ソースコード 拡げる

n, y = map(int, input().split())
def solve():
    for i in range(n + 1): # 10000 円札の枚数
        for j in range(n + 1 - i): # 5000 円札の枚数
            k = n - i - j # 1000 円札の枚数
            if 10000 * i + 5000 * j + 1000 * k == y:
                print(i, j, k)
                return
    print(-1, -1, -1)
solve()
# break 文では最も深いループしか抜けられない
# 関数と return を使うことで,すべてのループを抜ける実装のテクニックを使用している

提出情報

提出日時
問題 C - Otoshidama
ユーザ Pro_ktmr
言語 PyPy3 (7.3.0)
得点 300
コード長 533 Byte
結果 AC
実行時間 62 ms
メモリ 64540 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 4
AC × 24
セット名 テストケース
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
ケース名 結果 実行時間 メモリ
a01 AC 60 ms 61920 KiB
a02 AC 51 ms 61960 KiB
a03 AC 51 ms 62800 KiB
a04 AC 57 ms 64412 KiB
b05 AC 48 ms 61936 KiB
b06 AC 46 ms 61932 KiB
b07 AC 48 ms 61944 KiB
b08 AC 49 ms 61924 KiB
b09 AC 62 ms 64096 KiB
b10 AC 56 ms 64180 KiB
b11 AC 56 ms 64316 KiB
b12 AC 48 ms 61824 KiB
b13 AC 50 ms 62940 KiB
b14 AC 49 ms 63020 KiB
b15 AC 56 ms 64304 KiB
b16 AC 55 ms 64268 KiB
b17 AC 57 ms 64316 KiB
b18 AC 52 ms 61836 KiB
b19 AC 54 ms 62960 KiB
b20 AC 50 ms 62904 KiB
b21 AC 56 ms 64336 KiB
b22 AC 55 ms 64184 KiB
b23 AC 58 ms 64100 KiB
b24 AC 58 ms 64540 KiB