結果

問題 No.1844 Divisors Sum Sum
ユーザー 👑 colognecologne
提出日時 2022-03-14 20:35:07
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,737 ms / 3,000 ms
コード長 575 bytes
コンパイル時間 3,384 ms
コンパイル使用メモリ 247,580 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 07:41:50
合計ジャッジ時間 29,912 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,704 ms
4,348 KB
testcase_01 AC 1,735 ms
4,348 KB
testcase_02 AC 1,737 ms
4,348 KB
testcase_03 AC 1,734 ms
4,348 KB
testcase_04 AC 1,731 ms
4,348 KB
testcase_05 AC 1,731 ms
4,348 KB
testcase_06 AC 1,735 ms
4,348 KB
testcase_07 AC 1,729 ms
4,348 KB
testcase_08 AC 1,735 ms
4,348 KB
testcase_09 AC 1,737 ms
4,348 KB
testcase_10 AC 1,586 ms
4,348 KB
testcase_11 AC 335 ms
4,348 KB
testcase_12 AC 1,199 ms
4,348 KB
testcase_13 AC 167 ms
4,348 KB
testcase_14 AC 568 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 3 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using Mint = atcoder::modint1000000007;

// sum j=0...e j p^(e-j)
Mint sum2(Mint p, int e)
{
    if (e == 1)
        return 1;
    if (!(e & 1))
        return e + p * sum2(p, e - 1);
    return (1 + p.pow(e - e / 2)) * sum2(p, e / 2) +
           (e - e / 2) * (p.pow(e / 2 + 1) - 1) / (p - 1);
}

int main()
{
    int L;
    cin >> L;
    Mint ret = 1;
    for (int i = 0; i < L; i++)
    {
        int p, e;
        cin >> p >> e;
        ret *= sum2(p, e + 1);
    }
    cout << ret.val() << endl;
}
0