結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
8,324 KB
testcase_02 AC 15 ms
8,316 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 14 ms
8,280 KB
testcase_08 AC 15 ms
8,176 KB
testcase_09 AC 15 ms
8,192 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 202 ms
18,400 KB
testcase_16 AC 214 ms
18,736 KB
testcase_17 AC 209 ms
18,888 KB
testcase_18 AC 206 ms
18,564 KB
testcase_19 AC 204 ms
18,740 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
8,212 KB
testcase_31 AC 78 ms
9,992 KB
testcase_32 AC 80 ms
10,024 KB
testcase_33 AC 169 ms
19,008 KB
testcase_34 AC 16 ms
8,332 KB
testcase_35 WA -
testcase_36 AC 16 ms
8,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y,z=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    if int(a[i])>999:
        pay=int(a[i]//1000+1)
        while pay>0:
            if len(str(pay))>1:
                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:
                if pay<=x:
                    x-=pay
                    pay=-1
                if pay<=5*y:
                    p=pay//5
                    y-=p
                    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