結果
問題 | No.1529 Constant Lcm |
ユーザー |
👑 ![]() |
提出日時 | 2021-06-04 20:14:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 657 bytes |
コンパイル時間 | 667 ms |
コンパイル使用メモリ | 74,408 KB |
最終ジャッジ日時 | 2025-01-21 21:40:41 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 WA * 2 |
ソースコード
#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(){ int 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 == 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;