結果

問題 No.3236 累乗数大好きbot
ユーザー Today03
提出日時 2025-08-17 15:38:00
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,368 bytes
コンパイル時間 3,191 ms
コンパイル使用メモリ 285,544 KB
実行使用メモリ 66,944 KB
最終ジャッジ日時 2025-08-17 15:38:16
合計ジャッジ時間 14,852 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)

template<typename T> bool chmax(T& a, T b) { return a<b ? a=b, true : false; }
template<typename T> bool chmin(T& a, T b) { return a>b ? a=b, true : false; }
using ll=long long; const int INF=1e9+10; const ll INFL=4e18;
using VI=vector<int>; using VVI=vector<VI>; using VL=vector<ll>; using VVL=vector<VL>;
using PL=pair<ll,ll>; using VP=vector<PL>; using WG=vector<vector<pair<int,ll>>>;

#ifdef LOCAL
#include "./debug.hpp"
#else
#define debug(...)
#define print_line
#endif


//----------------------------------------------------------

void solve() {
    int Q; cin>>Q;

    map<ll,int> mp;
    for(ll t=1; t<=1e6; t++) {
        chmax(mp[t*t],2);
        if(t<=1e4) chmax(mp[t*t*t],3);
        if(t<=1e3) chmax(mp[t*t*t*t],4), chmax(mp[t*t*t*t*t],5);
        if(t<=1e2) chmax(mp[t*t*t*t*t*t],6);
    }

    for(ll a=2; a<=100; a++) {
        ll tmp=a; int c=0;
        while(tmp*a<=1e12) {
            tmp*=a; c++;
            chmax(mp[tmp],c);
        }
    }

    while(Q--) {
        ll N; cin>>N;

        if(mp.count(N)) cout<<mp[N]<<'\n';
        else cout<<1<<'\n';
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //cout<<fixed<<setprecision(15);
    int T=1; //cin>>T;
    while(T--) solve();
}
0