結果

問題 No.2709 1975 Powers
ユーザー n_na
提出日時 2024-04-01 22:11:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-09-30 22:29:11
合計ジャッジ時間 5,485 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P,Q = map(int,input().split())
A = list(map(int,input().split()))

R,S,T,U = [],[],[],[]
for a in A:
    R.append(pow(10,a,P))
    S.append(pow(9,a,P))
    T.append(pow(7,a,P))
    U.append(pow(5,a,P))

cnt = 0
for i in range(0,N-3):
    a = R[i]
    for j in range(i+1,N-2):
        b = S[j]
        for k in range(j+1,N-1):
            c = T[k]
            for l in range(k+1, N):
                d = U[l]
                z = (a+b+c+d)%P
                if z == Q:
                    cnt += 1
print(cnt)
0