QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
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); | ~~~~~^~~~~~~~~~~