結果
| 問題 | No.36 素数が嫌い! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-30 05:00:05 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 600 bytes |
| 記録 | |
| コンパイル時間 | 2,487 ms |
| コンパイル使用メモリ | 175,560 KB |
| 実行使用メモリ | 46,844 KB |
| 最終ジャッジ日時 | 2026-07-30 05:00:15 |
| 合計ジャッジ時間 | 5,205 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 22 WA * 4 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(void){
ll n; cin >> n;
if(n==1){
cout << "NO" << endl; return 0;
}
int nn=1e7+1;
vector<int> yakusu(nn+1, -1), prime;
for(int i=2; i<=nn; i++){
if(yakusu[i]!=-1) continue;
int copy=i;
prime.push_back(i);
while(copy<=nn){
if(yakusu[copy]==-1) yakusu[copy]=i;
copy+=i;
}
}
int cnt=0;
for(auto p:prime){
if(n%p==0){
cnt++;
while(n%p==0) n/=p;
}
}
if(n>1) cnt++;
cout << (cnt>=3?"YES":"NO") << endl;
return 0;
}