結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
![]() |
提出日時 | 2018-12-07 02:33:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 1,222 ms |
コンパイル使用メモリ | 158,388 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-14 03:10:44 |
合計ジャッジ時間 | 2,096 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 13 WA * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool primejudge(long int N){ long int k = (long int)powl(N,1/2); if(N == 1){ return true; }else{ for(long int i=2;i<=k;i++){ if(N % i == 0){ return false; } } return true; } } bool judge(long int N){ long int k = (long int)powl(N,1/2); if(N == 1){ return true; }else{ for(long int i=2;i<=k;i++){ if(!primejudge(i)){ if(N % i == 0) false; } } return true; } } int main(){ long int N; cin >> N; if(judge(N)) cout << "NO" << endl; else cout << "YES" << endl; return 0; }