QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#380510#8508. DiviDueloGannyWA 0ms3672kbC++141.1kb2024-04-07 05:06:592024-04-07 05:06:59

Judging History

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

  • [2024-04-07 05:06:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3672kb
  • [2024-04-07 05:06:59]
  • 提交

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[]){
    long int N;
    cin >> N;
    
    if ((esPrimo(N) || N == 1) && (N % 2 != 0 || N == 2)){
        cout << "N" << endl;
        return 0;
    }else{
        cout << "Y" << endl;
    }

    // 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){
    //     cout << "Y" << endl;
    // } else {
    //     cout << "N" << endl;
    // }
    
    return 0;
}

詳細信息

Test #1:

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

input:

10

output:

Y

result:

ok "Y"

Test #2:

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

input:

9

output:

Y

result:

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