結果
| 問題 |
No.2709 1975 Powers
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2024-03-31 13:53:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 353 bytes |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 84,864 KB |
| 最終ジャッジ日時 | 2024-09-30 18:33:27 |
| 合計ジャッジ時間 | 4,119 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 TLE * 1 -- * 23 |
ソースコード
from itertools import combinations
from functools import lru_cache
N, P, Q = map(int, input().split())
A = sorted(map(int, input().split()))
@lru_cache(10**7)
def power(x, y):
return pow(x, y, P)
ans = 0
for a, b, c, d in combinations(A, r=4):
if (power(10, a) + power(9, b) + power(7, c) + power(5, d)) % P == Q:
ans += 1
print(ans)