Submission #1176574
Source Code Expand
#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #include "dump.hpp" #else #define dump(...) #endif //#define int long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(c) begin(c),end(c) const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f; const int MOD = (int)(1e9) + 7; template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } bool is_prime(int x) { if (x <= 1)return false; else if (x == 2)return true; if (x % 2 == 0)return false; for (int i = 3; i*i <= x; i += 2) if (x%i == 0)return false; return true; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; cout << (is_prime(N) ? "YES" : "NO") << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 素数、コンテスト、素数 |
User | minaminao |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 936 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 256 KB |
00_sample_02.txt | AC | 1 ms | 256 KB |
00_sample_03.txt | AC | 1 ms | 256 KB |
00_sample_04.txt | AC | 1 ms | 256 KB |
01_test_01.txt | AC | 1 ms | 256 KB |
01_test_02.txt | AC | 1 ms | 256 KB |
01_test_03.txt | AC | 1 ms | 256 KB |
01_test_04.txt | AC | 1 ms | 256 KB |
01_test_05.txt | AC | 1 ms | 256 KB |
01_test_06.txt | AC | 1 ms | 256 KB |
01_test_07.txt | AC | 1 ms | 256 KB |
01_test_08.txt | AC | 1 ms | 256 KB |
01_test_09.txt | AC | 1 ms | 256 KB |
01_test_10.txt | AC | 1 ms | 256 KB |
01_test_11.txt | AC | 1 ms | 256 KB |
01_test_12.txt | AC | 1 ms | 256 KB |
01_test_13.txt | AC | 1 ms | 256 KB |
01_test_14.txt | AC | 1 ms | 256 KB |
01_test_15.txt | AC | 1 ms | 256 KB |
01_test_16.txt | AC | 1 ms | 256 KB |
01_test_17.txt | AC | 1 ms | 256 KB |
01_test_18.txt | AC | 1 ms | 256 KB |
01_test_19.txt | AC | 1 ms | 256 KB |
01_test_20.txt | AC | 1 ms | 256 KB |
01_test_21.txt | AC | 1 ms | 256 KB |
01_test_22.txt | AC | 1 ms | 256 KB |
01_test_23.txt | AC | 1 ms | 256 KB |
01_test_24.txt | AC | 1 ms | 256 KB |
01_test_25.txt | AC | 1 ms | 256 KB |