QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#380443#8508. DiviDuelojohnsoveroWA 0ms3760kbC++14819b2024-04-07 04:02:462024-04-07 04:02:48

Judging History

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

  • [2024-04-07 04:02:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3760kb
  • [2024-04-07 04:02:46]
  • 提交

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});

    for(pair<int,int> e: factors) cout << e.first << " " << e.second << '\n';
    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 (N != 1 && 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: 0
Wrong Answer
time: 0ms
memory: 3760kb

input:

10

output:

2 1
5 1
Y

result:

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