結果

問題 No.300 平方数
ユーザー kahuu
提出日時 2016-03-13 01:39:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 340 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 22,912 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-09-25 11:14:08
合計ジャッジ時間 2,995 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 TLE * 1 -- * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   scanf("%lld", &x);
      |   ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>

int main(void) {
  long long int x;
  scanf("%lld", &x);

  long long int i = 2;
  long long int answer = 1;

  while (true) {
    long long int j = 0;
    while (x % i == 0) {
      x /= i;
      j++;
    }
    if (j % 2 == 1) answer *= i;
    if (x == 1) break;
    i++;
  }

  printf("%lld\n", answer);

  return 0;
}
0