結果

問題 No.2709 1975 Powers
ユーザー N_noa21N_noa21
提出日時 2024-03-31 19:49:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 547 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 75,400 KB
最終ジャッジ日時 2024-03-31 19:49:49
合計ジャッジ時間 7,621 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 55 ms
66,272 KB
testcase_03 AC 296 ms
75,368 KB
testcase_04 AC 449 ms
75,368 KB
testcase_05 AC 330 ms
75,400 KB
testcase_06 AC 150 ms
75,396 KB
testcase_07 AC 42 ms
59,884 KB
testcase_08 AC 139 ms
75,400 KB
testcase_09 AC 341 ms
75,396 KB
testcase_10 AC 44 ms
59,972 KB
testcase_11 AC 67 ms
68,360 KB
testcase_12 AC 80 ms
72,452 KB
testcase_13 AC 341 ms
75,400 KB
testcase_14 AC 94 ms
73,064 KB
testcase_15 AC 111 ms
75,400 KB
testcase_16 AC 283 ms
75,400 KB
testcase_17 AC 55 ms
66,280 KB
testcase_18 AC 86 ms
72,452 KB
testcase_19 AC 447 ms
75,400 KB
testcase_20 AC 63 ms
68,360 KB
testcase_21 AC 137 ms
75,400 KB
testcase_22 AC 521 ms
75,368 KB
testcase_23 AC 547 ms
75,396 KB
testcase_24 AC 524 ms
75,400 KB
testcase_25 AC 519 ms
75,368 KB
testcase_26 AC 521 ms
75,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P,Q = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

ten = []
nine = []
seven = []
five = []
for i in A:
    ten.append(pow(10,i,P))
    nine.append(pow(9,i,P))
    seven.append((pow(7,i,P)))
    five.append((pow(5,i,P)))
cnt = 0
#print(ten)
#print(nine)
#print(seven)
#print(five)
for a in range(N):
    for b in range(a+1,N):
        for c in range(b+1,N):
            for d in range(c+1,N):
                #print(a,b,c,d)
                if (ten[a]+nine[b]+seven[c]+five[d])%P == Q:
                    cnt += 1
print(cnt)
0