結果

問題 No.376 立方体のN等分 (2)
ユーザー nebukuro09nebukuro09
提出日時 2016-10-31 14:51:01
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 3,425 ms / 5,000 ms
コード長 548 bytes
コンパイル時間 2,170 ms
コンパイル使用メモリ 84,056 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-02 22:39:14
合計ジャッジ時間 21,361 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,368 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 91 ms
4,368 KB
testcase_03 AC 90 ms
4,372 KB
testcase_04 AC 105 ms
4,368 KB
testcase_05 AC 1 ms
4,368 KB
testcase_06 AC 1 ms
4,368 KB
testcase_07 AC 2 ms
4,368 KB
testcase_08 AC 6 ms
4,368 KB
testcase_09 AC 23 ms
4,368 KB
testcase_10 AC 218 ms
4,368 KB
testcase_11 AC 47 ms
4,368 KB
testcase_12 AC 64 ms
4,368 KB
testcase_13 AC 67 ms
4,368 KB
testcase_14 AC 74 ms
4,372 KB
testcase_15 AC 82 ms
4,372 KB
testcase_16 AC 2,979 ms
4,368 KB
testcase_17 AC 92 ms
4,372 KB
testcase_18 AC 94 ms
4,372 KB
testcase_19 AC 97 ms
4,372 KB
testcase_20 AC 100 ms
4,368 KB
testcase_21 AC 2,996 ms
4,372 KB
testcase_22 AC 103 ms
4,372 KB
testcase_23 AC 3,097 ms
4,372 KB
testcase_24 AC 2,981 ms
4,368 KB
testcase_25 AC 107 ms
4,368 KB
testcase_26 AC 3,425 ms
4,372 KB
testcase_27 AC 108 ms
4,368 KB
testcase_28 AC 108 ms
4,368 KB
testcase_29 AC 109 ms
4,372 KB
testcase_30 AC 110 ms
4,368 KB
testcase_31 AC 108 ms
4,372 KB
testcase_32 AC 109 ms
4,372 KB
testcase_33 AC 109 ms
4,372 KB
testcase_34 AC 108 ms
4,368 KB
testcase_35 AC 108 ms
4,376 KB
testcase_36 AC 109 ms
4,368 KB
testcase_37 AC 110 ms
4,368 KB
testcase_38 AC 109 ms
4,372 KB
testcase_39 AC 109 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import core.stdc.stdlib;

void main() {
  long N = readln().chomp.to!long;
  long[] factors;

  long i = 1;
  while (i*i <= N) {
    if (N % i == 0) {
      factors ~= i;
      factors ~= N/i;
    }
    i++;
  }

  long ans = long.max;
  foreach (a; factors) {
    foreach (b; factors) {
      if (N/a%b == 0) {
        long c = N/a/b;
        ans = min(ans, a+b+c-3);
      }
    }
  }
  writeln(ans, " ", N-1);
}
0