結果

問題 No.1844 Divisors Sum Sum
ユーザー ぷらぷら
提出日時 2022-02-18 22:02:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 214 ms / 3,000 ms
コード長 776 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 199,888 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2023-09-11 19:09:48
合計ジャッジ時間 6,782 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
6,160 KB
testcase_01 AC 212 ms
6,272 KB
testcase_02 AC 212 ms
6,180 KB
testcase_03 AC 214 ms
6,276 KB
testcase_04 AC 214 ms
6,232 KB
testcase_05 AC 214 ms
6,148 KB
testcase_06 AC 213 ms
6,400 KB
testcase_07 AC 212 ms
6,236 KB
testcase_08 AC 213 ms
6,180 KB
testcase_09 AC 213 ms
6,172 KB
testcase_10 AC 194 ms
5,912 KB
testcase_11 AC 42 ms
4,376 KB
testcase_12 AC 145 ms
5,340 KB
testcase_13 AC 22 ms
4,376 KB
testcase_14 AC 68 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,384 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,384 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,384 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 1 ms
4,384 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

constexpr int mod = 1000000007;

long long modpow(long long a,long long b) {
    long long ans = 1;
    while(b) {
        if(b & 1) {
            (ans *= a) %= mod;
        }
        (a *= a) %= mod;
        b /= 2;
    }
    return ans;
}

int main() {
    int L;
    cin >> L;
    vector<long long>P(L),e(L);
    long long ans = 1;
    for(int i = 0; i < L; i++) {
        cin >> P[i] >> e[i];
        long long tmp = 0;
        tmp += modpow(P[i],e[i]+2);
        tmp += mod-P[i]*e[i]%mod;
        tmp += e[i];
        tmp += mod-2*P[i]%mod;
        tmp += 1;
        tmp %= mod;
        tmp *= modpow((P[i]-1)*(P[i]-1)%mod,mod-2);
        tmp %= mod;
        ans *= tmp;
        ans %= mod;
    }
    cout << ans << endl;
}
0