結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 351 ms
4,348 KB
testcase_03 AC 748 ms
4,348 KB
testcase_04 AC 499 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 AC 9 ms
4,348 KB
testcase_09 AC 37 ms
4,348 KB
testcase_10 AC 627 ms
4,348 KB
testcase_11 AC 120 ms
4,348 KB
testcase_12 AC 298 ms
4,348 KB
testcase_13 AC 114 ms
4,348 KB
testcase_14 AC 148 ms
4,348 KB
testcase_15 AC 102 ms
4,348 KB
testcase_16 AC 4,078 ms
4,348 KB
testcase_17 AC 295 ms
4,348 KB
testcase_18 AC 98 ms
4,348 KB
testcase_19 AC 593 ms
4,348 KB
testcase_20 AC 128 ms
4,348 KB
testcase_21 AC 4,584 ms
4,348 KB
testcase_22 AC 104 ms
4,348 KB
testcase_23 AC 4,814 ms
4,348 KB
testcase_24 AC 4,838 ms
4,348 KB
testcase_25 AC 105 ms
4,348 KB
testcase_26 TLE -
testcase_27 AC 177 ms
4,348 KB
testcase_28 AC 105 ms
4,348 KB
testcase_29 AC 283 ms
4,348 KB
testcase_30 AC 181 ms
4,348 KB
testcase_31 AC 105 ms
4,348 KB
testcase_32 AC 204 ms
4,348 KB
testcase_33 AC 105 ms
4,348 KB
testcase_34 AC 105 ms
4,348 KB
testcase_35 AC 231 ms
4,348 KB
testcase_36 AC 105 ms
4,348 KB
testcase_37 AC 105 ms
4,348 KB
testcase_38 AC 244 ms
4,348 KB
testcase_39 AC 301 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){
      ans = min(ans, (i-1)+(n/i-1));
      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