結果

問題 No.811 約数の個数の最大化
ユーザー yuruhiyayuruhiya
提出日時 2021-04-18 11:40:50
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,682 ms / 2,000 ms
コード長 172 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 11,220 KB
実行使用メモリ 22,360 KB
最終ジャッジ日時 2023-09-17 07:33:06
合計ジャッジ時間 11,361 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
15,352 KB
testcase_01 AC 106 ms
15,460 KB
testcase_02 AC 1,529 ms
22,212 KB
testcase_03 AC 99 ms
15,352 KB
testcase_04 AC 101 ms
15,540 KB
testcase_05 AC 120 ms
15,608 KB
testcase_06 AC 181 ms
15,756 KB
testcase_07 AC 222 ms
15,908 KB
testcase_08 AC 743 ms
18,504 KB
testcase_09 AC 761 ms
18,700 KB
testcase_10 AC 510 ms
17,444 KB
testcase_11 AC 1,467 ms
22,196 KB
testcase_12 AC 413 ms
17,404 KB
testcase_13 AC 1,672 ms
22,360 KB
testcase_14 AC 1,682 ms
22,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
n, k = gets.split.map(&:to_i)
p (2...n).map { |i|
	[i,n.gcd(i).prime_division.sum{_2},i.prime_division.reduce(1){_1*-~_2[1]}]
}.select{_2>=k}.max_by{_3}[0]
0