結果
問題 | No.2751 429-like Number |
ユーザー | Spica08 |
提出日時 | 2024-05-10 22:15:07 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 3,137 ms / 4,000 ms |
コード長 | 929 bytes |
コンパイル時間 | 2,386 ms |
コンパイル使用メモリ | 202,004 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-05-10 22:15:21 |
合計ジャッジ時間 | 11,979 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 3 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 3 ms
6,940 KB |
testcase_07 | AC | 18 ms
6,944 KB |
testcase_08 | AC | 18 ms
6,940 KB |
testcase_09 | AC | 29 ms
6,940 KB |
testcase_10 | AC | 3,137 ms
6,940 KB |
testcase_11 | AC | 426 ms
6,944 KB |
testcase_12 | AC | 487 ms
6,944 KB |
testcase_13 | AC | 331 ms
6,944 KB |
testcase_14 | AC | 1,121 ms
6,944 KB |
testcase_15 | AC | 18 ms
6,944 KB |
testcase_16 | AC | 129 ms
6,940 KB |
testcase_17 | AC | 177 ms
6,944 KB |
testcase_18 | AC | 324 ms
6,944 KB |
testcase_19 | AC | 329 ms
6,944 KB |
testcase_20 | AC | 349 ms
6,940 KB |
testcase_21 | AC | 322 ms
6,944 KB |
testcase_22 | AC | 321 ms
6,944 KB |
testcase_23 | AC | 353 ms
6,940 KB |
testcase_24 | AC | 329 ms
6,940 KB |
testcase_25 | AC | 315 ms
6,940 KB |
testcase_26 | AC | 331 ms
6,940 KB |
testcase_27 | AC | 363 ms
6,944 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using Matrix = vector<vector<ll>>; const int inf = 1000000000; const ll INF = 1000000000000000000; const ll mod = 998244353; const ull mod_hash = (1UL << 61) - 1; const vector<int> dx = {0, 1, 0, -1, 1, 1, -1, -1}; const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1}; int prime(ll x) { int res = 0; while (x % 2 == 0) { res++; x /= 2; } while (x % 3 == 0) { res++; x /= 3; } for (ll i = 1; (6 * i - 1) * (6 * i - 1) <= x; i++) { while (x % (6 * i - 1) == 0) { res++; x /= (6 * i - 1); } while (x % (6 * i + 1) == 0) { res++; x /= (6 * i + 1); } } if (x != 1) { res++; } return res; } int main(){ int Q;cin>>Q; while(Q--){ ll a;cin>>a; if(prime(a) ==3){ cout<<"Yes"<<endl; }else{ cout<<"No"<<endl; } } return 0; }