結果

問題 No.542 1円玉と5円玉
ユーザー rkyrky
提出日時 2017-10-28 13:21:32
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 482 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2024-05-01 20:48:33
合計ジャッジ時間 1,867 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
12,160 KB
testcase_01 AC 79 ms
12,032 KB
testcase_02 AC 86 ms
12,288 KB
testcase_03 AC 84 ms
12,160 KB
testcase_04 AC 81 ms
12,288 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 81 ms
12,160 KB
testcase_11 AC 81 ms
12,160 KB
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - i
Main.rb:4: warning: assigned but unused variable - j
Syntax OK

ソースコード

diff #

def sum_roop(yen1, yen2, num1, num2, list, sum)
	for i in 0...yen1 do
		list << sum += num1
		for j in 0...yen2 do
			list << sum += num2
		end
	end
	list
end


one_yen, five_yen = gets.chomp.split(" ").map(&:to_i)
list = Array.new
sum = 0
(0...one_yen).each{ list << sum += 1}
sum = 0
(0...five_yen).each{ list << sum += 5}
sum = 0

 if five_yen > one_yen
 	sum_roop(one_yen, five_yen, 1, 5, list, sum)
 else sum_roop(five_yen, one_yen, 5, 1, list, sum)
 end

puts list.uniq.sort()
0