結果

問題 No.375 立方体のN等分 (1)
ユーザー simansiman
提出日時 2021-11-12 13:23:02
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 316 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 11,180 KB
実行使用メモリ 15,352 KB
最終ジャッジ日時 2023-08-16 10:47:26
合計ジャッジ時間 8,424 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,172 KB
testcase_01 AC 84 ms
15,116 KB
testcase_02 AC 225 ms
15,220 KB
testcase_03 AC 82 ms
15,048 KB
testcase_04 WA -
testcase_05 AC 82 ms
15,228 KB
testcase_06 AC 83 ms
15,140 KB
testcase_07 AC 102 ms
15,168 KB
testcase_08 AC 176 ms
15,004 KB
testcase_09 AC 96 ms
15,120 KB
testcase_10 AC 120 ms
15,092 KB
testcase_11 AC 114 ms
15,224 KB
testcase_12 AC 124 ms
15,220 KB
testcase_13 AC 124 ms
15,312 KB
testcase_14 AC 428 ms
15,112 KB
testcase_15 WA -
testcase_16 AC 122 ms
15,104 KB
testcase_17 AC 671 ms
15,268 KB
testcase_18 AC 468 ms
15,040 KB
testcase_19 AC 143 ms
15,096 KB
testcase_20 WA -
testcase_21 AC 106 ms
15,108 KB
testcase_22 AC 845 ms
15,108 KB
testcase_23 AC 125 ms
15,208 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 144 ms
15,220 KB
testcase_28 AC 105 ms
15,188 KB
testcase_29 WA -
testcase_30 AC 121 ms
15,004 KB
testcase_31 AC 132 ms
15,140 KB
testcase_32 AC 105 ms
15,188 KB
testcase_33 AC 128 ms
15,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
a = 1
min_v = Float::INFINITY

while a ** 3 < N
  if N % a == 0
    m = N / a
    b = 1

    while b ** 2 < m
      if m % b == 0
        c = m / b
        v = (a - 1) + (b - 1) + (c - 1)
        min_v = v if min_v > v
      end

      b += 1
    end
  end

  a += 1
end

puts [min_v, N - 1].join(' ')
0