結果
| 問題 | No.2709 1975 Powers |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 15:13:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 366 bytes |
| 記録 | |
| コンパイル時間 | 447 ms |
| コンパイル使用メモリ | 82,352 KB |
| 実行使用メモリ | 168,272 KB |
| 最終ジャッジ日時 | 2024-09-30 20:26:23 |
| 合計ジャッジ時間 | 3,880 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | TLE * 1 -- * 24 |
ソースコード
from itertools import combinations
def count_ways(N, P, Q, A):
ways = 0
powers = [10**a % P for a in A]
for a, b, c, d in combinations(range(N), 4):
if (powers[a] + 9**A[b] + 7**A[c] + 5**A[d]) % P == Q:
ways += 1
return ways
N, P, Q = map(int, input().split())
A = list(map(int, input().split()))
print(count_ways(N, P, Q, A))