結果
| 問題 | No.2709 1975 Powers |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 15:13:57 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 366 bytes |
| 記録 | |
| コンパイル時間 | 184 ms |
| コンパイル使用メモリ | 85,004 KB |
| 実行使用メモリ | 210,380 KB |
| 最終ジャッジ日時 | 2026-04-16 22:11:25 |
| 合計ジャッジ時間 | 4,196 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))