結果

問題 No.542 1円玉と5円玉
コンテスト
ユーザー R_F
提出日時 2017-12-14 11:54:55
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
WA  
実行時間 -
コード長 886 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,093 ms
コンパイル使用メモリ 475,832 KB
実行使用メモリ 57,732 KB
最終ジャッジ日時 2026-05-14 15:58:48
合計ジャッジ時間 12,976 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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