結果

問題 No.375 立方体のN等分 (1)
ユーザー shinjiwebshinjiweb
提出日時 2016-06-23 14:42:31
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,840 ms / 5,000 ms
コード長 229 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 16,384 KB
最終ジャッジ日時 2024-04-20 02:15:01
合計ジャッジ時間 11,291 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
12,416 KB
testcase_01 AC 79 ms
12,416 KB
testcase_02 AC 420 ms
12,544 KB
testcase_03 AC 81 ms
12,416 KB
testcase_04 AC 77 ms
12,544 KB
testcase_05 AC 78 ms
12,544 KB
testcase_06 AC 81 ms
12,416 KB
testcase_07 AC 123 ms
12,544 KB
testcase_08 AC 301 ms
12,544 KB
testcase_09 AC 107 ms
12,416 KB
testcase_10 AC 172 ms
12,416 KB
testcase_11 AC 161 ms
12,416 KB
testcase_12 AC 180 ms
12,416 KB
testcase_13 AC 182 ms
12,416 KB
testcase_14 AC 892 ms
12,800 KB
testcase_15 AC 230 ms
12,288 KB
testcase_16 AC 176 ms
12,288 KB
testcase_17 AC 1,453 ms
13,056 KB
testcase_18 AC 977 ms
12,672 KB
testcase_19 AC 224 ms
12,544 KB
testcase_20 AC 140 ms
12,544 KB
testcase_21 AC 135 ms
12,416 KB
testcase_22 AC 1,840 ms
16,384 KB
testcase_23 AC 185 ms
12,416 KB
testcase_24 AC 136 ms
12,672 KB
testcase_25 AC 379 ms
12,544 KB
testcase_26 AC 173 ms
12,544 KB
testcase_27 AC 227 ms
12,544 KB
testcase_28 AC 137 ms
12,544 KB
testcase_29 AC 135 ms
12,544 KB
testcase_30 AC 171 ms
12,672 KB
testcase_31 AC 207 ms
12,288 KB
testcase_32 AC 132 ms
12,416 KB
testcase_33 AC 183 ms
12,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
array = []
1.upto(n**(1.0 / 3.0) + 1) do |a|
  next unless n % a == 0
  1.upto((n / a)**(1.0 / 2.0) + 1) do |b|
    array << (a + b + n / (a * b) - 3) if n / a % b == 0
  end
end
print array.min
print ' '
puts n - 1
0