結果

問題 No.375 立方体のN等分 (1)
ユーザー mudbdbmudbdb
提出日時 2016-06-05 00:12:20
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 03:23:05
合計ジャッジ時間 1,171 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%d", &N);
      |   ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main()
{
  int N,N1,N2,N3;
  int d1,d2,d3;
  scanf("%d", &N);
  N2 = 0;
  int min = N;
  for (d1=2; d1*d1<=N; d1++) {
    if (N%d1 == 0) {
      N2=N/d1;
      if (N2 != 1) {
        for (d2=2; d2*d2<=N2; d2++) {
          if (N2%d2 == 0) {
            N3=N2/d2;
            if (min > (d1-1+d2-1+N3-1)) min = (d1-1+d2-1+N3-1);
          }
        }
      } else {
        if (min > (d1-1)) min = d1-1;
      }
    }
  }
  if (N2 == 0) {
    printf("%d %d\n", N-1, N-1);
  } else {
    printf("%d %d\n", min, N-1);
  }
  return 0;
}
0