Luzhiled's Library

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub ei1333/library

:heavy_check_mark: test/verify/aoj-alds-1-1-c.test.cpp

Depends on

Code

// clang-format off
// competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C
// clang-format on

#include <iostream>

#include "../../math/number-theory/is-prime.hpp"

using namespace std;

int main() {
  int N;
  cin >> N;
  int ret = 0;
  while (N--) {
    int x;
    cin >> x;
    ret += is_prime(x);
  }
  cout << ret << endl;
}
#line 1 "test/verify/aoj-alds-1-1-c.test.cpp"
// clang-format off
// competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C
// clang-format on

#include <iostream>

#line 2 "math/number-theory/is-prime.hpp"

#include <cstdint>

bool is_prime(std::int64_t x) {
  if (x < 2) return false;
  for (std::int64_t i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}
#line 8 "test/verify/aoj-alds-1-1-c.test.cpp"

using namespace std;

int main() {
  int N;
  cin >> N;
  int ret = 0;
  while (N--) {
    int x;
    cin >> x;
    ret += is_prime(x);
  }
  cout << ret << endl;
}

Test cases

Env Name Status Elapsed Memory
g++ testcase_00 :heavy_check_mark: AC 2 ms 4 MB
g++ testcase_01 :heavy_check_mark: AC 2 ms 4 MB
g++ testcase_02 :heavy_check_mark: AC 2 ms 4 MB
g++ testcase_03 :heavy_check_mark: AC 17 ms 4 MB
clang++ testcase_00 :heavy_check_mark: AC 2 ms 4 MB
clang++ testcase_01 :heavy_check_mark: AC 2 ms 4 MB
clang++ testcase_02 :heavy_check_mark: AC 2 ms 4 MB
clang++ testcase_03 :heavy_check_mark: AC 12 ms 4 MB
Back to top page