結果

問題 No.1396 Giri
ユーザー eQeeQe
提出日時 2021-03-21 14:53:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 429 ms / 2,000 ms
コード長 1,728 bytes
コンパイル時間 4,785 ms
コンパイル使用メモリ 233,984 KB
実行使用メモリ 15,984 KB
最終ジャッジ日時 2023-08-14 11:24:33
合計ジャッジ時間 9,133 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 427 ms
15,868 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 426 ms
15,780 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 5 ms
4,380 KB
testcase_18 AC 26 ms
4,380 KB
testcase_19 AC 203 ms
9,824 KB
testcase_20 AC 292 ms
12,488 KB
testcase_21 AC 386 ms
14,456 KB
testcase_22 AC 427 ms
15,552 KB
testcase_23 AC 429 ms
15,728 KB
testcase_24 AC 424 ms
15,984 KB
testcase_25 AC 428 ms
15,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define itr(x,c) for(auto x=c.begin();x!=c.end();x++)
#define ritr(x,c) for(auto x=c.rbegin();x!=c.rend();x++)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define __builtin_popcount(v) popcount(v)
using namespace std;
#include <atcoder/all>
using namespace atcoder;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
//static const ll MOD=998244353;
//for(i=0;i<N;i++) cin>>a[i];

typedef vector<ll> v1d;
typedef vector<v1d> v2d;
typedef vector<v2d> v3d;
typedef vector<v3d> v4d;



template <typename T>
struct PrimeFact {
  vector<T> spf;
  PrimeFact(T N) { init(N); }
  void init(T N) { // 前処理。spf を求める
    spf.assign(N + 1, 0);
    for (T i = 0; i <= N; i++) spf[i] = i;
    for (T i = 2; i * i <= N; i++) {
      if (spf[i] != i) continue;
      
      for (T j = i + i; j <= N; j += i) {
        spf[j] = i;
      }
    }
  }
  map<T, T> get(T n) { // nの素因数分解を求める
    map<T, T> m;
    while (n != 1) {
      m[spf[n]]++;
      n /= spf[n];
    }
    return m;
  }
};


int main(void) {
  ll i,j,k,l;
  
  ll N;cin>>N;
  PrimeFact<ll> pf(N);
  map<ll,ll> cnt;
  for(i=1;i<=N;i++){
    map<ll,ll> pri=pf.get(i);
    itr(it,pri){
      chmax(cnt[it->first],it->second);
    }
  }
  
  
  modint998244353 ans=1;
  itr(it,cnt){
    ans*=modint998244353(it->first).pow(it->second);
  }
  
  ans/=prev(cnt.end())->first;
  pt(ans.val());
  
  
  
  
  
}
0