結果

問題 No.2709 1975 Powers
ユーザー yaakiyuyaakiyu
提出日時 2024-03-31 14:11:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,966 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 19,840 KB
最終ジャッジ日時 2024-03-31 14:11:35
合計ジャッジ時間 3,553 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
19,840 KB
testcase_01 AC 28 ms
9,984 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# competetive programming
# 競プロにつかえるもの

# sys関連
import sys
#sys.setrecursionlimit(100000000)
if sys.version_info.minor >= 11:
    # python3.11以上でのみ4300桁制限がかかる
    sys.set_int_max_str_digits(10000000)

#input = lambda: sys.stdin.readline()[:-1]

### import関連
## もしpypyなら
#import pypyjit; pypyjit.set_param('max_unroll_recursion=-1')  # 再帰関数の展開をする
#from atcoder.dsu import DSU  # UnionFind 使い方:uf=DSU(頂点数) ; uf.merge(u, v) ; uf.same(u, v) ; uf.leader(u) ; uf.size(u) ; uf.groups()
#from atcoder.scc import SCCGraph # SCC 使い方:g=SCCGraph(頂点数) ; g.add_edge(u, v) ; scc=g.scc()
#from atcoder.segtree import SegTree # セグ木 使い方:tree=SegTree(関数, 単位元, 元リスト) ; tree.set(pos, x) ; tree.prod(left, right + 1) # 閉区間
#import heapq # Priority Queue 使い方:q=[...] ; heapq.heapify(q) ; heapq.heappush(q, item) ; heapq.heappop(q, item)
#from collections import deque  # Queue 使い方:q=deque(lis) ; q.popleft(item) ; q.append(item)
#from collections import Counter # Counter
#from collections import defaultdict # defaultdict delに注意
#from itertools import accumulate # 累積和
from itertools import combinations # 組み合わせ
#from bisect import bisect_left, bisect_right # 二分探索
#from decimal import Decimal, getcontext; getcontext().prec = 100 # 正確な少数

### 定数関連
#inf = float("inf")
#inf = 10**18
#mod = 998244353
#mod = 1000000007 # 10**9+7
#dir = ((0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)) # 8近傍 4まで回せば4近傍

INTIN = lambda: int(input())
def MAPIN(kansu=int):
    return map(kansu, input().split())
LISTIN = lambda k=int: list(MAPIN(k))

n, p, q = MAPIN()
a = list(sorted(LISTIN()))

ans = 0
for a,b,c,d in combinations(a, 4):
	#print(a, b, c, d)
	if (pow(10, a, p) + pow(9, b, p) + pow(7, c, p) + pow(5, d, p)) % p == q:
		ans += 1

print(ans)
0