結果

問題 No.2379 Burnside's Theorem
ユーザー KoseTKoseT
提出日時 2023-07-14 21:28:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 2,135 ms
コンパイル使用メモリ 201,396 KB
実行使用メモリ 5,192 KB
最終ジャッジ日時 2023-10-14 11:26:02
合計ジャッジ時間 2,964 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
5,184 KB
testcase_01 AC 8 ms
4,976 KB
testcase_02 AC 8 ms
4,976 KB
testcase_03 AC 7 ms
5,060 KB
testcase_04 AC 8 ms
4,936 KB
testcase_05 AC 7 ms
5,052 KB
testcase_06 WA -
testcase_07 AC 7 ms
4,936 KB
testcase_08 AC 7 ms
4,976 KB
testcase_09 WA -
testcase_10 AC 8 ms
4,960 KB
testcase_11 AC 7 ms
5,088 KB
testcase_12 AC 7 ms
5,092 KB
testcase_13 AC 8 ms
5,032 KB
testcase_14 AC 7 ms
5,112 KB
testcase_15 AC 7 ms
4,948 KB
testcase_16 AC 8 ms
4,956 KB
testcase_17 AC 7 ms
5,088 KB
testcase_18 AC 8 ms
4,940 KB
testcase_19 AC 8 ms
5,056 KB
testcase_20 AC 8 ms
5,192 KB
testcase_21 AC 8 ms
4,940 KB
testcase_22 AC 8 ms
5,080 KB
testcase_23 AC 8 ms
5,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
 
using namespace std;

vector<long long> make_prime(const int& num) {
  vector<char> is_prime(num+1, 1);
  for (int i=2;i*i<=num;++i) {
    if (is_prime[i] == 0) continue;
    for (int j=i+i;j<=num;j+=i) is_prime[j] = 0;
  }
  vector<long long> prime;
  for (int i=2;i<=num;++i) if (is_prime[i] == 1) prime.push_back(i);
  return prime;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  long long n;
  cin >> n;
  vector<long long> prime = make_prime(1001001);
  int cnt {};
  for (const auto& e : prime) {
    if (n % e == 0) {
      while (n % e == 0) n /= e;
      ++cnt;
    }
  }
  if (cnt <= 2) cout << "Yes\n";
  else cout << "No\n";
}
0