結果

問題 No.2891 Mint
ユーザー 👑 kakel-sankakel-san
提出日時 2024-09-13 23:15:01
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 1,317 bytes
コンパイル時間 8,460 ms
コンパイル使用メモリ 167,092 KB
実行使用メモリ 184,884 KB
最終ジャッジ日時 2024-09-13 23:15:17
合計ジャッジ時間 15,030 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
30,192 KB
testcase_01 AC 55 ms
30,336 KB
testcase_02 AC 56 ms
29,696 KB
testcase_03 AC 55 ms
30,080 KB
testcase_04 AC 79 ms
30,592 KB
testcase_05 AC 56 ms
30,080 KB
testcase_06 AC 220 ms
30,464 KB
testcase_07 AC 55 ms
30,052 KB
testcase_08 AC 55 ms
29,952 KB
testcase_09 AC 55 ms
30,208 KB
testcase_10 AC 55 ms
29,696 KB
testcase_11 AC 55 ms
30,080 KB
testcase_12 AC 56 ms
29,796 KB
testcase_13 AC 54 ms
30,052 KB
testcase_14 AC 55 ms
30,080 KB
testcase_15 AC 54 ms
29,952 KB
testcase_16 AC 55 ms
29,952 KB
testcase_17 AC 174 ms
30,208 KB
testcase_18 AC 127 ms
30,336 KB
testcase_19 AC 118 ms
30,336 KB
testcase_20 AC 164 ms
30,208 KB
testcase_21 AC 119 ms
30,592 KB
testcase_22 AC 189 ms
30,464 KB
testcase_23 AC 103 ms
30,308 KB
testcase_24 AC 161 ms
30,180 KB
testcase_25 AC 202 ms
30,336 KB
testcase_26 AC 196 ms
30,300 KB
testcase_27 AC 188 ms
30,080 KB
testcase_28 AC 208 ms
30,448 KB
testcase_29 AC 124 ms
30,324 KB
testcase_30 AC 167 ms
30,336 KB
testcase_31 AC 126 ms
30,208 KB
testcase_32 AC 178 ms
30,332 KB
testcase_33 AC 143 ms
29,952 KB
testcase_34 AC 150 ms
30,076 KB
testcase_35 AC 163 ms
30,336 KB
testcase_36 AC 172 ms
30,332 KB
testcase_37 AC 75 ms
30,208 KB
testcase_38 AC 73 ms
30,080 KB
testcase_39 AC 77 ms
30,332 KB
testcase_40 AC 78 ms
30,204 KB
testcase_41 AC 67 ms
30,464 KB
testcase_42 AC 55 ms
29,924 KB
testcase_43 AC 55 ms
30,052 KB
testcase_44 AC 54 ms
29,952 KB
testcase_45 AC 55 ms
30,052 KB
testcase_46 AC 56 ms
29,824 KB
testcase_47 AC 75 ms
30,308 KB
testcase_48 AC 77 ms
30,308 KB
testcase_49 AC 79 ms
30,208 KB
testcase_50 AC 66 ms
30,208 KB
testcase_51 AC 72 ms
30,080 KB
testcase_52 AC 61 ms
30,336 KB
testcase_53 AC 70 ms
30,336 KB
testcase_54 AC 71 ms
30,080 KB
testcase_55 AC 58 ms
30,180 KB
testcase_56 AC 78 ms
184,884 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (95 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, m) = (c[0], c[1]);
        WriteLine(Mint(n, m));
    }
    static int half = 499122177;
    static long Mint(long n, long m)
    {
        checked {
        var mod = 998_244_353;
        var sq = (int)Math.Sqrt(m);
        var ans = 0L;
        for (var k = 1; k < sq && k <= n; ++k)
        {
            ans = (ans + m % k % mod) % mod;
        }
        for (var rk = 1; rk <= sq + 1; ++rk)
        {
            var mink = m / (rk + 1) + 1;
            mink = Math.Max(mink, sq);
            var maxk = m / rk;
            maxk = Math.Min(maxk, n);
            if (mink <= maxk)
            {
                var count = (maxk - mink + 1) % mod;
                ans = (ans + m % mod * count % mod - (mink + maxk) % mod * count % mod * half % mod * rk % mod + mod) % mod;
            }
        }
        if (n > m) ans = (ans + m % mod * ((n - m) % mod) % mod) % mod;
        return ans;
        }
    }
}
0