結果
問題 | No.1529 Constant Lcm |
ユーザー |
👑 ![]() |
提出日時 | 2021-06-04 20:16:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 3,000 ms |
コード長 | 666 bytes |
コンパイル時間 | 696 ms |
コンパイル使用メモリ | 74,512 KB |
最終ジャッジ日時 | 2025-01-21 21:42:42 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#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;