結果

問題 No.1529 Constant Lcm
ユーザー 👑 NachiaNachia
提出日時 2021-06-04 20:16:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 3,000 ms
コード長 666 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 75,928 KB
実行使用メモリ 6,988 KB
最終ジャッジ日時 2023-08-12 08:59:35
合計ジャッジ時間 1,860 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 10 ms
6,720 KB
testcase_11 AC 5 ms
4,384 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 9 ms
6,160 KB
testcase_14 AC 6 ms
5,156 KB
testcase_15 AC 7 ms
5,072 KB
testcase_16 AC 5 ms
4,692 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 4 ms
4,380 KB
testcase_19 AC 6 ms
5,140 KB
testcase_20 AC 11 ms
6,988 KB
testcase_21 AC 10 ms
6,860 KB
testcase_22 AC 11 ms
6,984 KB
testcase_23 AC 11 ms
6,932 KB
testcase_24 AC 11 ms
6,852 KB
testcase_25 AC 11 ms
6,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

const ull M = 998244353;

int main(){
  ll N; cin >> N;
  ull ans = 1;
  vector<int> P(N+1,0);
  for(ll i=2; i<N; i++) if(P[i]==0){
    for(ll j=i*i; j<=N; j+=i) P[j] = 1;
    ll n = N;
    while(n != i && n%i == 0){ ans = ans * i % M * i % M; n /= i; }
    n--;
    while(n >= i){ ans = ans * i % M; n /= i; }
  }
  cout << ans << "\n";
  return 0;
}



struct ios_do_not_sync{
  ios_do_not_sync(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  }
} ios_do_not_sync_instance;


0