結果
| 問題 | No.8023 素数判定するだけ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-06 00:31:50 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 579 bytes |
| 記録 | |
| コンパイル時間 | 768 ms |
| コンパイル使用メモリ | 100,444 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-08 17:23:20 |
| 合計ジャッジ時間 | 4,881 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <functional>
constexpr int ONE = true;
constexpr int TWO = std::plus<int>{}(ONE,ONE);
constexpr int ZERO = std::minus<int>{}(ONE,ONE);
int main()
{
int N;std::cin>>N;
if(N==ONE){
std::cout << "NO"<<std::endl;
return ZERO;
}
for(int p = TWO; std::multiplies<int>{}(p,p)<=N;p=std::plus<int>{}(p,ONE)){
if(N%p==ZERO){
std::cout << "NO"<<std::endl;
return ZERO;
}
}
std::cout << "YES"<<std::endl;
return ZERO;
}