結果

問題 No.542 1円玉と5円玉
ユーザー R_FR_F
提出日時 2017-12-14 11:54:55
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 886 bytes
コンパイル時間 13,243 ms
コンパイル使用メモリ 418,716 KB
実行使用メモリ 60,320 KB
最終ジャッジ日時 2023-08-12 21:38:35
合計ジャッジ時間 19,034 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:35:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

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()
	println((no542.list + no542.oneYenList + no542.fiveYenList).distinct().sorted())
}
0