結果

問題 No.300 平方数
ユーザー notetonous
提出日時 2016-04-09 01:51:29
言語 C90
(gcc 12.3.0)
結果
RE  
実行時間 -
コード長 355 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2024-10-04 04:58:59
合計ジャッジ時間 3,600 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 9 RE * 2 TLE * 1 -- * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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",&x);
      |   ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int p[100000];
int main(){
  long long int x;
  long long int y=1;
  int i;
  int max;
  scanf("%lld",&x);
  for(i=2;i*i<=x;i++){
    while(x%i==0){
      x=x/i;
      p[i]++;
      max=i;
    }
  }
  if(x!=1)printf("%lld\n",x);
  else{
    for(i=2;i<=max;i++){
      if(p[i]%2==1)y=y*i;
    }
    printf("%lld\n",y);
  }
  return 0;
}
0