QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#348870#6566. Power of Divisorsrealcomplex0#WA 21ms7620kbC++171.1kb2024-03-09 21:59:352024-03-09 21:59:35

Judging History

你现在查看的是最新测评结果

  • [2024-03-09 21:59:35]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:7620kb
  • [2024-03-09 21:59:35]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

bool is_pr(ll p){
    for(ll x = 2; x * 1ll * x <= p; x ++ ){
        if(p % x == 0) return false;
    }
    return true;
}

const int N = (int)1e6 + 10;
int cnt[N];

ll chk;

int main(){
    ll x;
    cin >> x;
    if(x==1){
        cout << "1\n";
        return 0;
    }
    ll l = 1;
    ll r = (ll)2e9;
    ll mid;
    while(l < r){
        mid = (l + r) / 2;
        if(mid * 1ll * mid >= x) r = mid;
        else l = mid + 1;
    }

    ll low = (ll)2e9;
    if(l * 1ll * l == x && is_pr(x)){
        low = l;
    }

    for(int i = 1; i < N; i ++ ){
        for(int j = i; j < N; j += i) cnt[j]++;
        if(i != 1){
            chk=0;
            ll y = x;
            while(y%i==0){
                chk++;
                y/=i;
            }
            if(y==1 && chk == cnt[i]){
                low=min(low, (ll)i);
            }
        }
    }
    cout << low << "\n";
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 21ms
memory: 7560kb

input:

15625

output:

25

result:

ok single line: '25'

Test #2:

score: 0
Accepted
time: 21ms
memory: 7560kb

input:

64000000

output:

20

result:

ok single line: '20'

Test #3:

score: -100
Wrong Answer
time: 17ms
memory: 7620kb

input:

65536

output:

2000000000

result:

wrong answer 1st lines differ - expected: '-1', found: '2000000000'