QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#380493 | #8508. DiviDuelo | Ganny | WA | 1ms | 3772kb | C++14 | 1000b | 2024-04-07 04:51:18 | 2024-04-07 04:51:19 |
Judging History
answer
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
bool esPrimo(int numero) {
if (numero <= 1) {
return false;
}
if (numero == 2 || numero == 3) {
return true;
}
if (numero % 2 == 0 || numero % 3 == 0) {
return false;
}
int maximoFactor = sqrt(numero);
for (int i = 5; i <= maximoFactor; i += 6) {
if (numero % i == 0 || numero % (i + 2) == 0) {
return false;
}
}
return true;
}
int main(int argc, char const *argv[]){
int N;
cin >> N;
if (esPrimo(N) || N == 1){
cout << "N" << endl;
return 0;
}
vector<int> v;
for (int i = 1; i <= N / 2; ++i) {
if (N % i == 0 && esPrimo(i)) {
v.push_back(i);
}
}
int size = v.size();
if (size % 2 == 0){
cout << "Y" << endl;
} else {
cout << "N" << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3772kb
input:
10
output:
Y
result:
ok "Y"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
9
output:
N
result:
ok "N"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1
output:
N
result:
ok "N"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3760kb
input:
549755813888
output:
N
result:
wrong answer 1st words differ - expected: 'Y', found: 'N'