結果
問題 |
No.2709 1975 Powers
|
ユーザー |
![]() |
提出日時 | 2024-03-31 15:27:25 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 679 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 65,080 KB |
最終ジャッジ日時 | 2024-09-30 20:43:11 |
合計ジャッジ時間 | 3,812 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 24 |
ソースコード
n, p, q = map(int, input().split()) A = list(map(int, input().split())) A.sort() ans = 0 def calc(base, candidate, p): val = 1 for _ in range(candidate): val *= base val %= p return val la = [] lb = [] lc = [] ld = [] for num in A: la.append(calc(10, num, p)) lb.append(calc(9, num, p)) lc.append(calc(7, num, p)) ld.append(calc(5, num, p)) for a in range(n-3): for b in range(a+1, n-2): for c in range(b+1, n-1): for d in range(c+1, n): val = la[a] + lb[b] + lc[c] + ld[d] if val%p == q: # print(a, b, c, d) ans += 1 print(ans)