結果

問題 No.2709 1975 Powers
ユーザー noriocnorioc
提出日時 2024-04-01 02:51:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 457 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 144,284 KB
最終ジャッジ日時 2024-04-01 02:51:52
合計ジャッジ時間 22,636 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
60,264 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 131 ms
137,984 KB
testcase_03 AC 1,660 ms
138,236 KB
testcase_04 TLE -
testcase_05 AC 1,860 ms
137,888 KB
testcase_06 AC 638 ms
138,648 KB
testcase_07 AC 108 ms
121,116 KB
testcase_08 AC 596 ms
139,088 KB
testcase_09 AC 1,845 ms
137,300 KB
testcase_10 AC 121 ms
122,348 KB
testcase_11 AC 160 ms
141,288 KB
testcase_12 AC 235 ms
137,996 KB
testcase_13 AC 1,925 ms
137,652 KB
testcase_14 AC 372 ms
136,744 KB
testcase_15 AC 388 ms
136,964 KB
testcase_16 AC 1,495 ms
138,888 KB
testcase_17 AC 107 ms
129,096 KB
testcase_18 AC 272 ms
137,492 KB
testcase_19 TLE -
testcase_20 AC 141 ms
140,092 KB
testcase_21 AC 573 ms
136,792 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

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

m = max(A) + 1
m10 = [1] * m
m9 = [1] * m
m7 = [1] * m
m5 = [1] * m
for i in range(1, m):
    m10[i] = m10[i-1] * 10 % P
    m9[i] = m9[i-1] * 9 % P
    m7[i] = m7[i-1] * 7 % P
    m5[i] = m5[i-1] * 5 % P

ans = 0
for a, b, c, d in combinations(A, 4):
    x = m10[a] + m9[b] + m7[c] + m5[d]
    if x % P == Q:
        ans += 1

print(ans)
0