結果
問題 | No.1844 Divisors Sum Sum |
ユーザー |
![]() |
提出日時 | 2022-02-21 00:26:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 174 ms / 3,000 ms |
コード長 | 651 bytes |
コンパイル時間 | 1,565 ms |
コンパイル使用メモリ | 166,804 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 10:59:10 |
合計ジャッジ時間 | 5,558 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
ソースコード
#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; }