QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#412537 | #6566. Power of Divisors | grass8cow# | Compile Error | / | / | C++17 | 700b | 2024-05-16 15:53:22 | 2024-05-16 15:53:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll X;
const int n=1e6;
const ll I=1e18;
int d[1010000];
ll mu(ll x,ll y){if(x<=I/y)return x*y;return I+1;}
ll qpow(ll a,ll b){
ll c=1;
for(;b;b>>=1){
if(b&1)c=mu(a,c);
a=mu(a,a);
}
return c;
}
bool pri(ll x){
for(ll i=2;i*i<=x;i++)if(!(x%i))return 0;return 1;
}
int main(){
scanf("%lld",&X);
for(int i=1;i<=n;i++)for(int j=1;i*j<=n;j++)d[i*j]++;
for(int i=1;i<=n;i++)if(qpow(i,d[i])==X){printf("%d\n",i);return 0;}
ll O=(ll)sqrt(X);
while(O*O<X)O++;while(O*O>X)O--;
if(O*O==x&&pri(O)){printf("%lld\n",O);return 0;}
puts("-1");
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:26:13: error: ‘x’ was not declared in this scope 26 | if(O*O==x&&pri(O)){printf("%lld\n",O);return 0;} | ^ answer.code:21:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%lld",&X); | ~~~~~^~~~~~~~~~~