結果

問題 No.1844 Divisors Sum Sum
ユーザー 👑 kakel-sankakel-san
提出日時 2023-12-07 22:20:30
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 567 ms / 3,000 ms
コード長 1,182 bytes
コンパイル時間 14,896 ms
コンパイル使用メモリ 158,576 KB
実行使用メモリ 179,604 KB
最終ジャッジ日時 2023-12-07 22:20:59
合計ジャッジ時間 28,635 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 519 ms
63,664 KB
testcase_01 AC 527 ms
63,924 KB
testcase_02 AC 542 ms
63,924 KB
testcase_03 AC 524 ms
63,920 KB
testcase_04 AC 551 ms
64,052 KB
testcase_05 AC 567 ms
63,924 KB
testcase_06 AC 528 ms
64,048 KB
testcase_07 AC 525 ms
63,924 KB
testcase_08 AC 545 ms
63,924 KB
testcase_09 AC 528 ms
64,048 KB
testcase_10 AC 517 ms
63,924 KB
testcase_11 AC 167 ms
43,172 KB
testcase_12 AC 381 ms
60,724 KB
testcase_13 AC 118 ms
38,052 KB
testcase_14 AC 214 ms
50,340 KB
testcase_15 AC 76 ms
32,420 KB
testcase_16 AC 76 ms
32,420 KB
testcase_17 AC 75 ms
32,420 KB
testcase_18 AC 76 ms
32,420 KB
testcase_19 AC 81 ms
32,420 KB
testcase_20 AC 76 ms
32,420 KB
testcase_21 AC 75 ms
32,420 KB
testcase_22 AC 76 ms
32,420 KB
testcase_23 AC 76 ms
32,420 KB
testcase_24 AC 76 ms
32,420 KB
testcase_25 AC 76 ms
32,420 KB
testcase_26 AC 75 ms
32,420 KB
testcase_27 AC 75 ms
32,420 KB
testcase_28 AC 75 ms
32,420 KB
testcase_29 AC 76 ms
32,420 KB
testcase_30 AC 77 ms
32,420 KB
testcase_31 AC 76 ms
32,420 KB
testcase_32 AC 77 ms
32,420 KB
testcase_33 AC 76 ms
32,420 KB
testcase_34 AC 81 ms
32,420 KB
testcase_35 AC 76 ms
32,420 KB
testcase_36 AC 76 ms
32,420 KB
testcase_37 AC 76 ms
179,604 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (93 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.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 int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var L = NN;
        var map = NArr(L);
        var mod = 1_000_000_007;
        var ans = 1L;
        for (var i = 0; i < L; ++i)
        {
            var p = (long)map[i][0];
            var e = (long)map[i][1];
            var rp = Exp(p - 1, mod - 2, mod);
            ans = ans * (Exp(p, e + 2, mod) - p * (e + 2) % mod + e + 1 + mod) % mod * rp % mod * rp % mod;
        }
        WriteLine(ans);
    }
    static long Exp(long n, long p, int mod)
    {
        long _n = n % mod;
        var _p = p;
        var result = 1L;
        if ((_p & 1) == 1) result *= _n;
        while (_p > 0)
        {
            _n = _n * _n % mod;
            _p >>= 1;
            if ((_p & 1) == 1) result = result * _n % mod;
        }
        return result;
    }
}
0