結果

問題 No.300 平方数
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-02-27 23:53:15
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 79,340 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 17:07:45
合計ジャッジ時間 3,134 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 34 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 19 ms
5,376 KB
testcase_16 AC 17 ms
5,376 KB
testcase_17 AC 34 ms
5,376 KB
testcase_18 AC 5 ms
5,376 KB
testcase_19 AC 14 ms
5,376 KB
testcase_20 AC 8 ms
5,376 KB
testcase_21 AC 34 ms
5,376 KB
testcase_22 WA -
testcase_23 AC 30 ms
5,376 KB
testcase_24 AC 20 ms
5,376 KB
testcase_25 WA -
testcase_26 AC 26 ms
5,376 KB
testcase_27 AC 18 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 32 ms
5,376 KB
testcase_30 AC 32 ms
5,376 KB
testcase_31 WA -
testcase_32 AC 21 ms
5,376 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 25 ms
5,376 KB
testcase_37 AC 21 ms
5,376 KB
testcase_38 WA -
testcase_39 AC 26 ms
5,376 KB
testcase_40 AC 24 ms
5,376 KB
testcase_41 AC 12 ms
5,376 KB
testcase_42 AC 21 ms
5,376 KB
testcase_43 AC 31 ms
5,376 KB
testcase_44 AC 25 ms
5,376 KB
testcase_45 AC 14 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using namespace std;

const int MOD = 1000000007; // 10^9 + 7

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll x; cin >> x;
  ll ans = 1, d = 2, y = x;
  for (ll d = 2; d * d <= x && y > 0; d++) {
    int cnt = 0;
    while (y % d == 0) {
      y /= d;
      cnt += 1;
    }
    if (cnt % 2 == 1) ans *= d;

    ll dd = x / d;
    if (dd == d) continue;

    cnt = 0;
    while (y % dd == 0) {
      y /= dd;
      cnt += 1;
    }
    if (cnt % 2 == 1) ans *= dd;
  }
  cout << ans << endl;
}
0