QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#380442 | #8508. DiviDuelo | johnsovero | WA | 0ms | 3512kb | C++14 | 731b | 2024-04-07 04:00:39 | 2024-04-07 04:00:40 |
Judging History
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'