結果

問題 No.1844 Divisors Sum Sum
ユーザー bekzhan29
提出日時 2022-02-21 21:43:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 122 ms / 3,000 ms
コード長 1,185 bytes
コンパイル時間 2,307 ms
コンパイル使用メモリ 190,620 KB
最終ジャッジ日時 2025-01-28 01:17:31
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <chrono>
#include <random>
using namespace std;
#define pb push_back
#define mp make_pair
#define INF ll(1e18)
#define mod 998244353
#define mod2 1000000007
#define eps 1e-9
#define abs(x) ((x)>=0?(x):-(x))
#define y1 solai
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
const ll N=200100;
ll n,a,b,ans=1,x,y;
ll bin(ll a, ll n)
{
	ll ans=1;
	while(n)
	{
		if(n&1)
			ans*=a,ans%=mod2;
		a*=a,a%=mod2;
		n/=2;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>a>>b;
		x=bin(a,b+2)-a*b+b-2*a+1;
		x=(x%mod2+mod2)%mod2;
		y=(a-1)*(a-1)%mod2;
		ans*=x*bin(y,mod2-2)%mod2;
		ans%=mod2;
	}
	cout<<ans;
}
/*
10
914260891 350096548
887686339 192497607
786328273 878092875
735623069 355760739
129154631 798229587
427094807 82130028
520933789 204087959
641996039 29097051
278883373 321445979
447005677 226153917

*/
0