結果

問題 No.375 立方体のN等分 (1)
ユーザー notetonous
提出日時 2016-06-04 23:51:36
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 22,144 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-08 10:42:19
合計ジャッジ時間 1,460 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%lld",&n);
      |   ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>
int main(){
  long long int n,a;
  int min=0,max=0;
  int i;
  int root;
  scanf("%lld",&n);
  max=n-1;
  a=2;
  while(n>=a*a){
    if(n%a==0){
      //printf("%d*",a);
      n=n/a;
      min+=(a-1);
    }
    else {
      a++;
    }
  }
  // printf("%d\n",n);
  if(min==0)min=n-1;
  else min+=n-1;
  printf("%d %d\n",min,max);
  return 0;
}
0