結果

問題 No.376 立方体のN等分 (2)
ユーザー sio_puyosio_puyo
提出日時 2016-06-04 23:28:39
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 946 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 2,919 ms
コンパイル使用メモリ 143,532 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-06 18:49:11
合計ジャッジ時間 8,764 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 30 ms
4,376 KB
testcase_03 AC 37 ms
4,376 KB
testcase_04 AC 946 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 17 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 30 ms
4,376 KB
testcase_11 AC 242 ms
4,376 KB
testcase_12 AC 16 ms
4,380 KB
testcase_13 AC 206 ms
4,380 KB
testcase_14 AC 294 ms
4,380 KB
testcase_15 AC 172 ms
4,380 KB
testcase_16 AC 179 ms
4,380 KB
testcase_17 AC 16 ms
4,380 KB
testcase_18 AC 195 ms
4,380 KB
testcase_19 AC 30 ms
4,380 KB
testcase_20 AC 256 ms
4,380 KB
testcase_21 AC 202 ms
4,380 KB
testcase_22 AC 7 ms
4,384 KB
testcase_23 AC 212 ms
4,376 KB
testcase_24 AC 214 ms
4,376 KB
testcase_25 AC 10 ms
4,376 KB
testcase_26 AC 222 ms
4,376 KB
testcase_27 AC 350 ms
4,376 KB
testcase_28 AC 7 ms
4,376 KB
testcase_29 AC 567 ms
4,380 KB
testcase_30 AC 10 ms
4,380 KB
testcase_31 AC 169 ms
4,384 KB
testcase_32 AC 10 ms
4,376 KB
testcase_33 AC 7 ms
4,384 KB
testcase_34 AC 108 ms
4,380 KB
testcase_35 AC 458 ms
4,380 KB
testcase_36 AC 210 ms
4,376 KB
testcase_37 AC 209 ms
4,384 KB
testcase_38 AC 491 ms
4,380 KB
testcase_39 AC 32 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
  LL n;
  cin >> n;
  LL answer=n;
  for(LL a=46420;a>=1;--a){
    if(n%a) continue;
    LL b;
    for(b=a;a*b*b<=n;++b);
    for(;b>=a;--b){
      if(a+b+n/a/b-3>answer) break;
      if(n/a%b) continue;
      answer=min(answer,a+b+n/a/b-3);
    }
  }
  cout << answer << ' ' << n-1 << endl;
  return 0;
}
0