結果

問題 No.1844 Divisors Sum Sum
ユーザー ygd.ygd.
提出日時 2022-02-18 22:07:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 577 ms / 3,000 ms
コード長 913 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 76,744 KB
最終ジャッジ日時 2023-09-11 19:14:51
合計ジャッジ時間 11,576 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 524 ms
76,624 KB
testcase_01 AC 567 ms
76,576 KB
testcase_02 AC 577 ms
76,656 KB
testcase_03 AC 567 ms
76,604 KB
testcase_04 AC 576 ms
76,500 KB
testcase_05 AC 566 ms
76,744 KB
testcase_06 AC 572 ms
76,680 KB
testcase_07 AC 572 ms
76,456 KB
testcase_08 AC 571 ms
76,604 KB
testcase_09 AC 571 ms
76,380 KB
testcase_10 AC 529 ms
76,576 KB
testcase_11 AC 176 ms
76,672 KB
testcase_12 AC 420 ms
76,572 KB
testcase_13 AC 128 ms
76,596 KB
testcase_14 AC 243 ms
76,744 KB
testcase_15 AC 69 ms
71,320 KB
testcase_16 AC 69 ms
71,312 KB
testcase_17 AC 69 ms
71,348 KB
testcase_18 AC 70 ms
71,376 KB
testcase_19 AC 72 ms
71,312 KB
testcase_20 AC 71 ms
71,216 KB
testcase_21 AC 70 ms
71,332 KB
testcase_22 AC 72 ms
71,160 KB
testcase_23 AC 69 ms
71,376 KB
testcase_24 AC 70 ms
71,356 KB
testcase_25 AC 68 ms
71,248 KB
testcase_26 AC 69 ms
71,228 KB
testcase_27 AC 69 ms
71,148 KB
testcase_28 AC 70 ms
71,160 KB
testcase_29 AC 68 ms
71,176 KB
testcase_30 AC 69 ms
71,160 KB
testcase_31 AC 69 ms
71,092 KB
testcase_32 AC 70 ms
71,244 KB
testcase_33 AC 70 ms
71,264 KB
testcase_34 AC 70 ms
71,384 KB
testcase_35 AC 71 ms
71,256 KB
testcase_36 AC 70 ms
71,316 KB
testcase_37 AC 68 ms
71,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline #文字列につけてはダメ
input = sys.stdin.buffer.readline #文字列につけてはダメ
#sys.setrecursionlimit(1000000)
#import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
#from collections import defaultdict 
#from collections import deque
#import copy
#import math
#from functools import lru_cache
#@lru_cache(maxsize=None)
MOD = pow(10,9) + 7
#MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]


def main():
    L = int(input())
    ans = 1
    for i in range(L):
        p,e = map(int,input().split())
        inv = pow(1-p,MOD-2,MOD)
        #print(inv)
        x = e+1 - p*(1 - pow(p,e,MOD)) * inv - pow(p,e+1,MOD)
        #print(e+1, p*(1 - pow(p,e,MOD)), pow(p,e+1))
        x %= MOD
        #print(x)
        x *= inv
        ans *= x%MOD
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()
0