結果

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

ソースコード

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;
    ans = max(ans, f(1));
    ans = max(ans, f(2));
    ans = max(ans, f(3));
    ans = max(ans, f(n - 1));
    ans = max(ans, f(n + 0));
    ans = max(ans, f(n + 1));
    ans = max(ans, f(m - 1));
    ans = max(ans, f(m + 0));
    ans = max(ans, f(m + 1));
    cout << ans << endl;
}
0