結果

問題 No.2709 1975 Powers
ユーザー flippergo
提出日時 2025-07-15 10:47:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 395 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 76,040 KB
最終ジャッジ日時 2025-07-15 10:48:09
合計ジャッジ時間 21,829 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 TLE * 4 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations
N,P,Q = map(int,input().split())
A = sorted(list(map(int,input().split())))
P10 = [pow(10,A[i],P) for i in range(N)]
P9 = [pow(9,A[i],P) for i in range(N)]
P7 = [pow(7,A[i],P) for i in range(N)]
P5 = [pow(5,A[i],P) for i in range(N)]
ans = 0
for x in combinations(range(N),4):
    i,j,k,l = x
    if (P10[i]+P9[j]+P7[k]+P5[l])%P==Q:
        ans += 1
print(ans)
0