結果

問題 No.1844 Divisors Sum Sum
ユーザー ytftytft
提出日時 2022-02-21 00:26:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 183 ms / 3,000 ms
コード長 651 bytes
コンパイル時間 1,506 ms
コンパイル使用メモリ 165,344 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 21:12:58
合計ジャッジ時間 7,417 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
4,376 KB
testcase_01 AC 182 ms
4,380 KB
testcase_02 AC 183 ms
4,376 KB
testcase_03 AC 182 ms
4,376 KB
testcase_04 AC 182 ms
4,380 KB
testcase_05 AC 182 ms
4,376 KB
testcase_06 AC 182 ms
4,380 KB
testcase_07 AC 183 ms
4,384 KB
testcase_08 AC 182 ms
4,376 KB
testcase_09 AC 182 ms
4,384 KB
testcase_10 AC 167 ms
4,380 KB
testcase_11 AC 36 ms
4,376 KB
testcase_12 AC 127 ms
4,376 KB
testcase_13 AC 19 ms
4,380 KB
testcase_14 AC 61 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 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;
long long p(long long a,long long b){
    int mod=pow(10,9)+7;
    long long ans=1,temp=a;
    while(b){
        if(b%2){
            ans=(ans*temp)%mod;
        }
        b>>=1;
        temp=(temp*temp)%mod;
    }
    return ans;
}

int main(){
    int L,mod=pow(10,9)+7;
    cin>>L;
    long long n=1,d=1,e,P;
    for(int i=0;i<L;++i){
        cin>>P>>e;
        long long temp=p(P,e+2);
        temp=(temp-e*(P-1))%mod;
        temp=(temp-2*P+1)%mod;
        n=(n*(temp+mod))%mod;
        for(int j=0;j<2;++j){
            d=(d*(P-1))%mod;
        }
    }
    n=(n*p(d,mod-2))%mod;
    cout<<n<<endl;
}
0