結果

問題 No.3236 累乗数大好きbot
コンテスト
ユーザー tnakao0123
提出日時 2025-08-16 12:46:27
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 177 ms / 4,000 ms
+ 419µs
コード長 760 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 316 ms
コンパイル使用メモリ 74,340 KB
実行使用メモリ 46,464 KB
最終ジャッジ日時 2026-07-14 05:28:41
合計ジャッジ時間 7,492 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

/* -*- coding: utf-8 -*-
 *
 * 3236.cc:  No.3236 邏ッ荵玲焚螟ァ螂ス縺甲ot - yukicoder
 */

#include<cstdio>
#include<unordered_map>
#include<algorithm>

using namespace std;

/* constant */

const long long MAX_N = 1000000000000LL;

/* typedef */

using ll = long long;
using umli = unordered_map<ll,int>;

/* global variables */

/* subroutines */

/* main */

int main() {
  umli aes;
  for (int x = 2; (ll)x * x <= MAX_N; x++) {
    ll xe = (ll)x * x;
    if (aes.count(xe)) continue;
    aes[xe] = 2;

    xe *= x;
    for (int e = 3; xe <= MAX_N; xe *= x, e++) aes[xe] = e;
  }
  
  int tn;
  scanf("%d", &tn);

  while (tn--) {
    ll n;
    scanf("%lld", &n);

    int e = aes.count(n) ? aes[n] : 1;
    printf("%d\n", e);
  }

  return 0;
}
0