結果
問題 | No.2880 Max Sigma Mod |
ユーザー |
![]() |
提出日時 | 2024-11-06 11:12:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 3,000 ms |
コード長 | 466 bytes |
コンパイル時間 | 2,322 ms |
コンパイル使用メモリ | 194,064 KB |
最終ジャッジ日時 | 2025-02-25 02:25:17 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 48 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n, m; cin >> n >> m; vector<long long> ans(n + 1); vector<long long> div_cnt(n + 1); for (int i = 1; i <= m; i++) { for (int j = i; j <= n; j += i) { div_cnt[j] += i; } } for (int i = 1; i <= n; i++) { ans[i] = ans[i - 1] + m - div_cnt[i]; } cout << *max_element(ans.begin(), ans.end()) << '\n'; }