QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#792209#6566. Power of Divisorslukamosiashvili#WA 0ms3764kbC++171.4kb2024-11-29 06:31:122024-11-29 06:31:13

Judging History

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

  • [2024-11-29 06:31:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3764kb
  • [2024-11-29 06:31:12]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

long long ans = -1, n;

int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin >> n;

    if(n == 1){
        cout << 1;
        return 0;
    }

    long long sq = sqrt(n);
    if(sq * sq == n){
        bool flag = 0;
        for(long long i = 2; i <= sqrt(sq); i++){
            if(sq % i == 0){
                flag = 1;
                break;
            }
        }

        if(!flag) ans = sq;
    }

    long long cb = cbrt(n);
    long long sq_cb = sqrt(cb);
    if(cb * cb * cb == n && sq_cb * sq_cb == cb){
        bool flag = 0;
        for(long long i = 2; i < sq_cb; i++){
            if(cb % i == 0){
                flag = 1;
                break;
            }
        }

        if(!flag) ans = cb;
    }

    for(long long i = 1; i <= 50000; i++) {
        long long gamy = 0;
        long long sq = sqrt(i);
        for(long long j = 1; j <= sq; j++){
            if(i % j == 0) gamy += 2;
        }

        if(sq * sq == i) gamy--;

        long long nam = 1;
        for(int ii = 1; ii <= gamy; ii++){
            if(n / i + 2 <= nam){
                nam = n + 1;
                break;
            }
            nam *= i;
        }

        if(nam == n){
            if(ans > i) ans = i;
            break;
        }
    }

    cout << ans;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3760kb

input:

15625

output:

25

result:

ok single line: '25'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3764kb

input:

64000000

output:

-1

result:

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