結果

問題 No.2880 Max Sigma Mod
ユーザー SnowBeenDiding
提出日時 2024-09-08 12:53:12
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 5,283 ms
コンパイル使用メモリ 307,336 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-08 12:53:31
合計ジャッジ時間 15,636 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;

typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;

    auto f = [&](int x) {
        if (!(1 <= x && x <= n))
            return 0LL;
        ll ret = 0;
        rep(i, 1, m + 1) { ret += x % i; }
        return ret;
    };

    ll ans = 0;
    rep(i, n - 300, n + 1) { ans = max(ans, f(i)); }
    // rep(i, 1, n + 1) { cerr << i << " " << f(i) << endl; }
    cout << ans << endl;
}
0