QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#348899#6566. Power of DivisorsjanY#WA 1ms3656kbC++17811b2024-03-09 22:13:102024-03-09 22:13:10

Judging History

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

  • [2024-03-09 22:13:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3656kb
  • [2024-03-09 22:13:10]
  • 提交

answer

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

void solve(){
    long long d, n;
    cin >> n;
    if (n == 1){
        cout << 1 << "\n";
        return;
    }
    for (int i = 2; i < 100000; i++){
        if (n%i == 0){
            int cnt = 0;
            long long ni = n;
            while (ni%i == 0) {
                ni /= i;
                cnt++;
            }
            if (ni != 1) continue;
            int dcnt = 0;
            for (int j = 1; j <= i; j++){
                if (i%j == 0) dcnt++;
            }
            if (cnt == dcnt){
                cout << i << "\n";
                return;
            }
        }
    }
    cout << "-1\n";
}

int main(){

    int t = 1;
    //cin >> t;
    for (int i = 0; i < t; i++) solve();

    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

15625

output:

25

result:

ok single line: '25'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

64000000

output:

20

result:

ok single line: '20'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3476kb

input:

65536

output:

-1

result:

ok single line: '-1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

1

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

10

output:

-1

result:

ok single line: '-1'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

100

output:

-1

result:

ok single line: '-1'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

10000

output:

10

result:

ok single line: '10'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

1000000000000000000

output:

100

result:

ok single line: '100'

Test #9:

score: -100
Wrong Answer
time: 1ms
memory: 3596kb

input:

10372926089038969

output:

-1

result:

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