結果

問題 No.376 立方体のN等分 (2)
ユーザー akakimidoriakakimidori
提出日時 2018-04-18 16:22:01
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 474 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 26,452 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 11:22:39
合計ジャッジ時間 4,908 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 62 ms
4,376 KB
testcase_03 AC 50 ms
4,380 KB
testcase_04 AC 474 ms
4,376 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 8 ms
4,384 KB
testcase_09 AC 15 ms
4,376 KB
testcase_10 AC 11 ms
4,380 KB
testcase_11 AC 120 ms
4,376 KB
testcase_12 AC 64 ms
4,380 KB
testcase_13 AC 103 ms
4,376 KB
testcase_14 AC 146 ms
4,380 KB
testcase_15 AC 86 ms
4,380 KB
testcase_16 AC 13 ms
4,376 KB
testcase_17 AC 37 ms
4,376 KB
testcase_18 AC 97 ms
4,376 KB
testcase_19 AC 59 ms
4,384 KB
testcase_20 AC 127 ms
4,380 KB
testcase_21 AC 14 ms
4,376 KB
testcase_22 AC 95 ms
4,380 KB
testcase_23 AC 15 ms
4,376 KB
testcase_24 AC 19 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 15 ms
4,380 KB
testcase_27 AC 176 ms
4,376 KB
testcase_28 AC 104 ms
4,380 KB
testcase_29 AC 282 ms
4,380 KB
testcase_30 AC 165 ms
4,376 KB
testcase_31 AC 83 ms
4,376 KB
testcase_32 AC 32 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 52 ms
4,380 KB
testcase_35 AC 227 ms
4,380 KB
testcase_36 AC 104 ms
4,380 KB
testcase_37 AC 104 ms
4,380 KB
testcase_38 AC 241 ms
4,380 KB
testcase_39 AC 70 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<math.h>

#define MIN(a,b) ((a)<(b)?(a):(b))

typedef long long int int64;

int64 calc(int64 n){
  int64 min=n-1;
  int i,j;
  for(i=1;(int64)i*i*i<=n;i++){
    if(n%i!=0) continue;
    int64 t=n/i;
    for(j=sqrt(t)+1;j>=i;j--){
      if(t%j==0){
	min=MIN(i-1+j-1+(t/j)-1,min);
	break;
      }
    }
  }
  return min;
}

void run(void){
  int64 n;
  scanf("%lld",&n);
  printf("%lld %lld\n",calc(n),n-1);
  return;
}

int main(void){
  run();
  return 0;
}
0