QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#380442#8508. DiviDuelojohnsoveroWA 0ms3512kbC++14731b2024-04-07 04:00:392024-04-07 04:00:40

Judging History

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

  • [2024-04-07 04:00:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3512kb
  • [2024-04-07 04:00:39]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace::std;

bool countDivisors(int n) 
{ 
    vector<pair<int, int>> factors;
    for (int i = 2; i * i <= n; i++) {
        int count = 0;
        while (n % i == 0) {
            n /= i;
            count++;
        }
        if (count > 0) factors.push_back({i, count});
    }
    if (n > 1) factors.push_back({n, 1});

    if(factors.size() == 1 && factors[0].second % 2 == 1) return true;
    else {
        for(pair<int, int> e: factors) {
            if(e.second > 1) return false;
        }
    }
    return true;
} 
int32_t main() {
    int N; cin >> N;
    if (countDivisors(N)) cout << "Y\n";
    else cout << "N\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10

output:

Y

result:

ok "Y"

Test #2:

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

input:

9

output:

N

result:

ok "N"

Test #3:

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

input:

1

output:

Y

result:

wrong answer 1st words differ - expected: 'N', found: 'Y'