結果

問題 No.2709 1975 Powers
ユーザー 👑 Nafmo2Nafmo2
提出日時 2024-01-25 01:53:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,069 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 254,496 KB
最終ジャッジ日時 2024-03-30 05:05:11
合計ジャッジ時間 18,046 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 488 ms
252,752 KB
testcase_03 AC 788 ms
252,756 KB
testcase_04 AC 936 ms
252,752 KB
testcase_05 AC 684 ms
252,756 KB
testcase_06 AC 452 ms
254,492 KB
testcase_07 AC 341 ms
254,492 KB
testcase_08 AC 467 ms
254,496 KB
testcase_09 AC 675 ms
254,496 KB
testcase_10 AC 364 ms
254,488 KB
testcase_11 AC 360 ms
254,492 KB
testcase_12 AC 389 ms
254,492 KB
testcase_13 AC 707 ms
254,492 KB
testcase_14 AC 401 ms
254,496 KB
testcase_15 AC 416 ms
254,496 KB
testcase_16 AC 707 ms
254,496 KB
testcase_17 AC 351 ms
254,492 KB
testcase_18 AC 383 ms
254,492 KB
testcase_19 AC 828 ms
254,496 KB
testcase_20 AC 349 ms
254,488 KB
testcase_21 AC 460 ms
254,496 KB
testcase_22 AC 1,062 ms
254,496 KB
testcase_23 AC 1,044 ms
254,496 KB
testcase_24 AC 988 ms
254,496 KB
testcase_25 AC 1,069 ms
254,496 KB
testcase_26 AC 1,069 ms
254,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#! /usr/bin/env pypy3
N, P, Q = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
p10 = [1]
p9 = [1]
p7 = [1]
p5 = [1]
for i in range(max(A)):
    p10.append(p10[i] * 10 % P)
    p9.append(p9[i] * 9 % P)
    p7.append(p7[i] * 7 % P)
    p5.append(p5[i] * 5 % P)
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            for l in range(k + 1, N):
                if (p10[A[i]] + p9[A[j]] + p7[A[k]] + p5[A[l]]) % P == Q:
                    ans += 1
print(ans)
0