結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
🍡yurahuna
|
| 提出日時 | 2016-05-05 15:52:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 101 ms / 5,000 ms |
| コード長 | 847 bytes |
| コンパイル時間 | 1,468 ms |
| コンパイル使用メモリ | 167,352 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 00:45:06 |
| 合計ジャッジ時間 | 2,747 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function 'long long int numPrimeFactor(long long int)':
main.cpp:24:16: warning: 'res' may be used uninitialized [-Wmaybe-uninitialized]
24 | if (n > 1) ++res;
| ^~~~~
main.cpp:17:9: note: 'res' was declared here
17 | int res;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long // <-----!!!!!!!!!!!!!!!!!!!
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef vector<vector<int>> VV;
int numPrimeFactor(int n) {
int res;
for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {
++res;
n /= i;
}
}
if (n > 1) ++res;
return res;
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int N;
cin >> N;
if (numPrimeFactor(N) >= 3) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
🍡yurahuna