結果

問題 No.375 立方体のN等分 (1)
ユーザー notetonous
提出日時 2016-06-04 23:34:57
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 301 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 23,552 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-08 10:12:45
合計ジャッジ時間 2,001 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 WA * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:11: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
    8 |   scanf("%d",&n);
      |          ~^  ~~
      |           |  |
      |           |  long long int *
      |           int *
      |          %lld
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%d",&n);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

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