結果
問題 | No.1015 おつりは要らないです |
ユーザー | yudedako |
提出日時 | 2022-01-26 17:59:47 |
言語 | Scala(Beta) (3.4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 14,799 ms |
コンパイル使用メモリ | 269,276 KB |
実行使用メモリ | 74,032 KB |
最終ジャッジ日時 | 2023-08-24 23:43:59 |
合計ジャッジ時間 | 70,025 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 954 ms
62,368 KB |
testcase_01 | AC | 971 ms
62,432 KB |
testcase_02 | AC | 947 ms
62,352 KB |
testcase_03 | AC | 944 ms
62,492 KB |
testcase_04 | AC | 954 ms
62,468 KB |
testcase_05 | AC | 950 ms
62,304 KB |
testcase_06 | AC | 941 ms
62,392 KB |
testcase_07 | AC | 949 ms
62,636 KB |
testcase_08 | AC | 952 ms
62,656 KB |
testcase_09 | AC | 947 ms
62,388 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | AC | 955 ms
62,304 KB |
testcase_31 | AC | 1,350 ms
74,032 KB |
testcase_32 | AC | 1,327 ms
73,516 KB |
testcase_33 | AC | 1,376 ms
73,768 KB |
testcase_34 | AC | 946 ms
62,760 KB |
testcase_35 | AC | 945 ms
62,436 KB |
testcase_36 | AC | 937 ms
62,300 KB |
ソースコード
import scala.annotation.tailrec import scala.io.StdIn.* import scala.math.* @main def main = val Array(n, x, y, z) = readLine().split(' ').map(_.toInt) val pay = readLine().split(' ').map(_.toInt) val bill = Array(1000 -> x, 5000 -> y, 10000 -> z) for (money, count) <- bill.reverseIterator do var rest = count for i <- 0 until n do if pay(i) >= money then val use = min(rest, pay(i) / money) pay(i) -= use * money rest -= use for i <- (0 until n).sortWith((i, j) => pay(i) % money >= pay(j) % money) do if rest > 0 && pay(i) >= 0 then rest -= 1 pay(i) -= money println(if pay.forall(_ < 0) then "Yes" else "No")