結果

問題 No.3689 LCM Sum (Easy Version)
コンテスト
ユーザー luminarian
提出日時 2026-09-09 20:55:18
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 145 ms / 2,000 ms
+ 190µs
コード長 500 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,231 ms
コンパイル使用メモリ 386,880 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-09-09 20:55:29
合計ジャッジ時間 6,264 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define ll long long
#define vl vector<ll>
#define vvl vector<vl>
using mint = modint998244353;

auto _ = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();

int main() {
  
  ll N, M; cin >> N >> M;
  
  mint ans = 0;
  
  for (ll i = 1; i <= N; i++) {
    
    for (ll j = 1; j <= M; j++) ans += (mint)i / std::gcd(i, j) * j;
    
  }
  
  cout << ans.val() << "\n";
  
  return 0;
  
}
0