結果

問題 No.1844 Divisors Sum Sum
ユーザー 👑 Nachia
提出日時 2022-02-18 23:00:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 144 ms / 3,000 ms
コード長 704 bytes
コンパイル時間 882 ms
コンパイル使用メモリ 76,840 KB
最終ジャッジ日時 2025-01-28 00:34:30
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
using namespace std;


using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned int;
#define rep(i,n) for(int i=0; i<(int)(n); i++)


using modint = atcoder::static_modint<1'000'000'007>;


int main() {
    int L; cin >> L;
    modint ans = 1;
    rep(i,L){
        int P,e; cin >> P >> e;
        ans *= (((modint(P).pow(e+2) - 1) / modint(P-1)) - (e+2)) / modint(P-1);
    }
    cout << ans.val() << endl;
    return 0;
}




struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
0