結果
問題 | No.542 1円玉と5円玉 |
ユーザー | R_F |
提出日時 | 2017-12-14 11:56:30 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 402 ms / 2,000 ms |
コード長 | 925 bytes |
コンパイル時間 | 13,658 ms |
コンパイル使用メモリ | 425,284 KB |
実行使用メモリ | 58,848 KB |
最終ジャッジ日時 | 2023-08-12 21:39:55 |
合計ジャッジ時間 | 20,427 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 330 ms
57,948 KB |
testcase_01 | AC | 320 ms
58,148 KB |
testcase_02 | AC | 328 ms
58,136 KB |
testcase_03 | AC | 318 ms
54,192 KB |
testcase_04 | AC | 335 ms
58,188 KB |
testcase_05 | AC | 355 ms
58,500 KB |
testcase_06 | AC | 359 ms
58,328 KB |
testcase_07 | AC | 363 ms
58,200 KB |
testcase_08 | AC | 354 ms
58,836 KB |
testcase_09 | AC | 356 ms
58,848 KB |
testcase_10 | AC | 336 ms
58,084 KB |
testcase_11 | AC | 335 ms
58,124 KB |
testcase_12 | AC | 402 ms
58,524 KB |
コンパイルメッセージ
Main.kt:35:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
import java.util.Scanner class No542() { var input = Scanner(System. `in`) var oneYenCount = input.nextInt() var fiveYenCount = input.nextInt() var oneYenList = yenCount(oneYenCount, 1) var fiveYenList = yenCount(fiveYenCount, 5) var list = fullSearch() fun yenCount(count: Int, plus: Int): MutableList<Int> { var sum = plus var list: MutableList<Int> = mutableListOf() for (i in 0..count - 1) { list.add(sum) sum += plus } return list } fun fullSearch(): MutableList<Int> { var list: MutableList<Int> = mutableListOf() for (i in 0..oneYenCount - 1) { for (j in 0..fiveYenCount - 1) { oneYenList[i] += fiveYenList[j] list.add(oneYenList[i]) oneYenList[i] -= fiveYenList[j] } } return list } } fun main(args: Array<String>) { var no542 = No542() var result = (no542.list + no542.oneYenList + no542.fiveYenList).distinct().sorted() result.forEach { println(it) } }