結果
問題 | No.36 素数が嫌い! |
ユーザー | motxx |
提出日時 | 2014-10-08 01:18:43 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 835 bytes |
コンパイル時間 | 1,809 ms |
コンパイル使用メモリ | 143,652 KB |
実行使用メモリ | 13,356 KB |
最終ジャッジ日時 | 2023-08-28 20:33:33 |
合計ジャッジ時間 | 4,549 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 47 ms
13,080 KB |
testcase_03 | AC | 46 ms
13,052 KB |
testcase_04 | AC | 47 ms
13,064 KB |
testcase_05 | AC | 46 ms
13,052 KB |
testcase_06 | AC | 47 ms
13,080 KB |
testcase_07 | AC | 47 ms
13,112 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 76 ms
13,052 KB |
testcase_12 | AC | 138 ms
13,052 KB |
testcase_13 | AC | 139 ms
13,092 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 47 ms
13,080 KB |
testcase_17 | AC | 47 ms
13,356 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 48 ms
13,056 KB |
testcase_27 | AC | 48 ms
13,064 KB |
testcase_28 | AC | 48 ms
13,348 KB |
testcase_29 | AC | 48 ms
13,100 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define MAX 10000010 bool prime[MAX]; typedef unsigned long long ull; void sieve() { fill(prime, prime+MAX, true); prime[0] = prime[1] = false; for(ull i=2 ; i*i<MAX ; i++){ if(prime[i]){ for(ull j=i*i ; j<MAX ; j+=i){ prime[j] = false; } } } } bool isPrime(ull a) { for(ull i=2; i*i <=a; i++) if(a%i == 0) return false; return true; } int main() { sieve(); ull N; cin >> N; if(N == 1) { cout << "NO\n"; return 0; } if(isPrime(N)) { cout << "NO\n"; return 0; } /* int cnt = 0; ull K = N; for(ull i=2; i*i<=K; i++) { if(prime[i]) { while(N % i == 0) { N /= i; cnt ++; } } } if(cnt >= 2) cout << "YES\n"; */ else cout << "NO\n"; return 0; }