結果

問題 No.376 立方体のN等分 (2)
ユーザー CleyLCleyL
提出日時 2023-11-06 22:48:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 68,380 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-11-06 22:48:51
合計ジャッジ時間 33,058 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 366 ms
4,348 KB
testcase_03 AC 797 ms
4,348 KB
testcase_04 AC 514 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 35 ms
4,348 KB
testcase_10 AC 648 ms
4,348 KB
testcase_11 AC 124 ms
4,348 KB
testcase_12 AC 308 ms
4,348 KB
testcase_13 AC 117 ms
4,348 KB
testcase_14 AC 151 ms
4,348 KB
testcase_15 WA -
testcase_16 AC 4,231 ms
4,348 KB
testcase_17 AC 303 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 615 ms
4,348 KB
testcase_20 AC 130 ms
4,348 KB
testcase_21 AC 4,725 ms
4,348 KB
testcase_22 AC 105 ms
4,348 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 AC 105 ms
4,348 KB
testcase_26 TLE -
testcase_27 WA -
testcase_28 AC 105 ms
4,348 KB
testcase_29 AC 292 ms
4,348 KB
testcase_30 AC 185 ms
4,348 KB
testcase_31 WA -
testcase_32 AC 181 ms
4,348 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 234 ms
4,348 KB
testcase_36 AC 106 ms
4,348 KB
testcase_37 AC 105 ms
4,348 KB
testcase_38 AC 249 ms
4,348 KB
testcase_39 AC 283 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
  long long n;cin>>n;
  long long ans = n-1;
  for(long long i = 2; n >= i*i; i++){
    if(n%i == 0){
      long long m = n/i;
      for(long long j = i; m >= j*j; j++){
        if(m%j == 0){
          ans = min(ans, (i-1)+(j-1)+(m/j-1));
        }
      }
    }
  }
  cout << ans << " " << n-1 << endl;
}
0