結果
| 問題 |
No.3236 累乗数大好きbot
|
| コンテスト | |
| ユーザー |
ゼリトキ
|
| 提出日時 | 2025-08-15 23:16:23 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 818 ms / 4,000 ms |
| コード長 | 908 bytes |
| コンパイル時間 | 3,253 ms |
| コンパイル使用メモリ | 274,796 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-15 23:17:58 |
| 合計ジャッジ時間 | 21,621 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
const long long mod=998244353;
const long long hmod=46216567629137;
ll solve(ll N){
for(ll i=40;i>=2;i--){
ll l=2,r=1e9;
while(l!=r){
ll m=(l+r)/2;
ll c=1;
bool ok=1;
for(int j=1;j<=i;j++){
c*=m;
if(c>N){
ok=0;
break;
}
}
if(ok) l=m+1;
else r=m;
}
l--;
ll c=1;
for(int j=1;j<=i;j++){
c*=l;
}
if(N==c){
return i;
}
}
return 1;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
cout.tie(0);
int Q;
cin>>Q;
for(int z=1;z<=Q;z++){
ll N;
cin>>N;
cout<<solve(N)<<"\n";
}
}
ゼリトキ