結果

問題 No.1015 おつりは要らないです
ユーザー syosinnsya8syosinnsya8
提出日時 2020-04-03 23:18:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,188 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 18,936 KB
最終ジャッジ日時 2023-09-16 04:45:31
合計ジャッジ時間 6,142 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 17 ms
7,992 KB
testcase_02 AC 18 ms
8,136 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 17 ms
8,008 KB
testcase_08 AC 16 ms
8,008 KB
testcase_09 AC 17 ms
8,008 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 192 ms
18,276 KB
testcase_16 AC 200 ms
18,672 KB
testcase_17 AC 203 ms
18,864 KB
testcase_18 AC 198 ms
18,580 KB
testcase_19 AC 198 ms
18,488 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 16 ms
7,968 KB
testcase_31 AC 66 ms
10,104 KB
testcase_32 AC 69 ms
10,120 KB
testcase_33 AC 157 ms
18,872 KB
testcase_34 AC 16 ms
7,964 KB
testcase_35 WA -
testcase_36 AC 15 ms
8,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y,z=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    if (a[i])>999:
        pay=int(a[i]//1000+1)
        while pay>0:
            if len(str(pay))>1:#10000円より多い
                if pay<=z:
                    p=pay//10
                    z-=p
                    pay-=p*10
                if pay<=5*y:
                    p=pay//5
                    y-=p
                    pay-=p*5
                if pay<=x:
                    x-=pay
                    pay=-1
            else:#10000円未満
                if pay<=5*y:
                    p=pay//5
                    y-=p
                    pay=-1
                if pay<=x:
                    x-=pay
                    pay=-1
                if pay<=z:
                    p=pay//10
                    z-=p
                    pay=-1
            a[i]=pay
            if pay >0:
                break
    else:
        if x>0:
            x-=1
            a[i]=-1
        elif y>0:
            y-=1
            a[i]=-1
        elif z>0:
            z-=1
            a[i]=-1
        else:
            break
if all(elem < 0 for elem in a):
    print('Yes')
else:
    print('No')
0