結果
問題 | No.542 1円玉と5円玉 |
ユーザー |
![]() |
提出日時 | 2017-12-14 11:56:30 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 453 ms / 2,000 ms |
コード長 | 925 bytes |
コンパイル時間 | 13,343 ms |
コンパイル使用メモリ | 439,736 KB |
実行使用メモリ | 61,520 KB |
最終ジャッジ日時 | 2024-11-20 13:34:40 |
合計ジャッジ時間 | 19,526 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
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) } }