結果

問題 No.811 約数の個数の最大化
ユーザー cielciel
提出日時 2019-04-20 15:01:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,182 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,640 KB
最終ジャッジ日時 2024-04-08 16:45:14
合計ジャッジ時間 8,479 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
16,512 KB
testcase_01 AC 115 ms
16,512 KB
testcase_02 AC 1,039 ms
16,640 KB
testcase_03 AC 103 ms
16,512 KB
testcase_04 AC 104 ms
16,512 KB
testcase_05 AC 114 ms
16,640 KB
testcase_06 AC 152 ms
16,640 KB
testcase_07 AC 182 ms
16,640 KB
testcase_08 AC 520 ms
16,640 KB
testcase_09 AC 545 ms
16,640 KB
testcase_10 AC 378 ms
16,640 KB
testcase_11 AC 1,017 ms
16,640 KB
testcase_12 AC 310 ms
16,640 KB
testcase_13 AC 1,182 ms
16,640 KB
testcase_14 AC 1,152 ms
16,640 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require'prime'
n,k=gets.split.map &:to_i
r=t=0
o=Hash[n.prime_division]
(2...n).each{|i|
	q=i.prime_division
	l=0
	q.each{|n,p|l+=[o[n].to_i,p].min}
	if l>=k
		s=q.map{|n,p|p+1}.reduce(:*)
		if r<s
			r=s
			t=i
		end
	end
}
p t
0