結果

問題 No.2709 1975 Powers
ユーザー rlangevinrlangevin
提出日時 2024-04-01 21:50:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,909 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 67,120 KB
最終ジャッジ日時 2024-04-01 21:50:52
合計ジャッジ時間 23,269 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 89 ms
63,100 KB
testcase_03 AC 1,139 ms
62,792 KB
testcase_04 AC 1,709 ms
65,076 KB
testcase_05 AC 1,278 ms
65,024 KB
testcase_06 AC 541 ms
64,712 KB
testcase_07 AC 37 ms
54,100 KB
testcase_08 AC 516 ms
65,176 KB
testcase_09 AC 1,285 ms
65,080 KB
testcase_10 AC 37 ms
54,100 KB
testcase_11 AC 126 ms
64,764 KB
testcase_12 AC 220 ms
65,256 KB
testcase_13 AC 1,303 ms
65,208 KB
testcase_14 AC 315 ms
62,744 KB
testcase_15 AC 383 ms
65,240 KB
testcase_16 AC 1,063 ms
64,808 KB
testcase_17 AC 56 ms
62,780 KB
testcase_18 AC 262 ms
65,240 KB
testcase_19 AC 1,659 ms
67,112 KB
testcase_20 AC 83 ms
65,220 KB
testcase_21 AC 507 ms
65,176 KB
testcase_22 AC 1,899 ms
65,164 KB
testcase_23 AC 1,895 ms
67,120 KB
testcase_24 AC 1,909 ms
64,812 KB
testcase_25 AC 1,873 ms
64,996 KB
testcase_26 AC 1,883 ms
65,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, P, Q = map(int, input().split())
C = [0] * P
A = list(map(int, input().split()))
A.sort()
ans = 0
for c in range(N - 1, -1, -1):
    for b in range(c - 1, -1, -1):
        for a in range(b - 1, -1, -1):
            now = pow(10, A[a], P) + pow(9, A[b], P) + pow(7, A[c], P)
            now %= P
            ans += C[(Q-now) % P]
            
    C[pow(5, A[c], P)] += 1
    
print(ans)
0