QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#380508#8508. DiviDueloGannyWA 1ms3572kbC++14827b2024-04-07 05:05:462024-04-07 05:05:46

Judging History

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

  • [2024-04-07 05:05:46]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3572kb
  • [2024-04-07 05:05:46]
  • 提交

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;

    cout << N%2 << " : " << N;
    
    if ((esPrimo(N) || N == 1) && (N % 2 != 0 || N == 2)){
        cout << "N" << endl;
        return 0;
    }else{
        cout << "Y" << endl;
    }
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3572kb

input:

10

output:

0 : 10Y

result:

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