結果
| 問題 |
No.1844 Divisors Sum Sum
|
| コンテスト | |
| ユーザー |
👑 potato167
|
| 提出日時 | 2021-08-25 04:24:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 472 ms / 3,000 ms |
| コード長 | 605 bytes |
| コンパイル時間 | 1,941 ms |
| コンパイル使用メモリ | 192,372 KB |
| 最終ジャッジ日時 | 2025-01-24 01:49:39 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
using ll=long long;
const int INF=2100000000;
ll mod=1e9+7;
#define rep(i,a) for (ll i=0;i<a;i++)
//retrun x^{y}
ll my_pow(ll x,ll y){
if(x==0) return 0;
if(y==0) return 1;
if(y%2) return (x*my_pow(x,y-1))%mod;
return my_pow((x*x)%mod,y/2);
}
// rainy ~ 雨に打たれて ~
int main() {
int N;
cin>>N;
ll ans=1;
rep(i,N){
ll P,e;
cin>>P>>e;
ll rev=my_pow(P-1,mod-2);
ll tmp=my_pow(P,e+1);
ans*=(rev*((tmp-e-1+(((tmp-P)*rev)%mod))%mod))%mod;
ans%=mod;
}
cout<<(ans+mod)%mod<<endl;
}
potato167