結果

問題 No.2891 Mint
ユーザー 👑 kakel-sankakel-san
提出日時 2024-09-13 23:05:04
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,341 bytes
コンパイル時間 9,558 ms
コンパイル使用メモリ 166,184 KB
実行使用メモリ 186,416 KB
最終ジャッジ日時 2024-09-13 23:05:25
合計ジャッジ時間 15,245 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
30,080 KB
testcase_01 AC 55 ms
29,952 KB
testcase_02 AC 56 ms
30,336 KB
testcase_03 AC 55 ms
29,784 KB
testcase_04 AC 83 ms
30,080 KB
testcase_05 AC 56 ms
29,824 KB
testcase_06 WA -
testcase_07 AC 55 ms
30,064 KB
testcase_08 AC 55 ms
29,824 KB
testcase_09 AC 55 ms
29,952 KB
testcase_10 AC 55 ms
29,824 KB
testcase_11 AC 55 ms
30,080 KB
testcase_12 AC 55 ms
30,080 KB
testcase_13 AC 54 ms
29,824 KB
testcase_14 AC 54 ms
30,080 KB
testcase_15 AC 55 ms
29,568 KB
testcase_16 AC 55 ms
32,100 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 72 ms
30,208 KB
testcase_38 AC 71 ms
30,456 KB
testcase_39 AC 75 ms
29,952 KB
testcase_40 AC 75 ms
30,080 KB
testcase_41 AC 67 ms
30,336 KB
testcase_42 AC 55 ms
29,928 KB
testcase_43 AC 55 ms
30,068 KB
testcase_44 AC 55 ms
29,696 KB
testcase_45 AC 54 ms
30,208 KB
testcase_46 AC 55 ms
30,080 KB
testcase_47 AC 74 ms
30,336 KB
testcase_48 AC 74 ms
30,192 KB
testcase_49 AC 77 ms
30,464 KB
testcase_50 AC 62 ms
30,080 KB
testcase_51 AC 72 ms
30,456 KB
testcase_52 AC 61 ms
30,320 KB
testcase_53 AC 69 ms
30,208 KB
testcase_54 AC 70 ms
30,336 KB
testcase_55 AC 58 ms
30,208 KB
testcase_56 AC 79 ms
186,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (96 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 long Mint(long n, long m)
    {
        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;
            // WriteLine($"k = {k}, {m % k}");
        }
        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);
            // WriteLine($"rk = {rk}, min={mink}, max={maxk}");
            if (mink <= maxk)
            {
                var count = maxk - mink + 1;
                ans = (ans + m * count - (mink + maxk) * count / 2 % mod * rk) % mod;
                // WriteLine($"        {m * count - (mink + maxk) * count / 2 * rk}");
            }
        }
        if (n > m) ans = (ans + m * (n - m) % mod) % mod;
        return ans;
    }
}
0