結果

問題 No.2127 Mod, Sum, Sum, Mod
ユーザー 遭難者遭難者
提出日時 2022-10-29 00:57:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 891 bytes
コンパイル時間 5,797 ms
コンパイル使用メモリ 209,528 KB
実行使用メモリ 7,736 KB
最終ジャッジ日時 2023-09-20 08:09:01
合計ジャッジ時間 9,098 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <stack>
#include <numeric>
#include <algorithm>
using namespace std;
using ll = long long;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    mint ans0 = 0, ans1 = 0;
    mint jsum = 0;
    for (int j = 1; j <= m; j++)
    {
        const ll nr = n % j;
        jsum += j - 1;
        ans0 += n / j * jsum;
        ans1 += nr * (nr + 1);
    }
    ans0 += ans1 / 2;
    printf("%d\n", ans0.val());
    return 0;
}
0