結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー Akijin_007Akijin_007
提出日時 2024-02-23 21:49:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 122,268 KB
最終ジャッジ日時 2024-02-23 21:50:04
合計ジャッジ時間 7,580 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 402 ms
120,652 KB
testcase_02 AC 418 ms
120,648 KB
testcase_03 AC 393 ms
120,648 KB
testcase_04 AC 395 ms
120,632 KB
testcase_05 AC 521 ms
122,268 KB
testcase_06 AC 537 ms
122,268 KB
testcase_07 AC 102 ms
77,916 KB
testcase_08 AC 98 ms
77,916 KB
testcase_09 AC 81 ms
76,436 KB
testcase_10 AC 81 ms
76,436 KB
testcase_11 AC 43 ms
59,836 KB
testcase_12 AC 43 ms
59,836 KB
testcase_13 AC 71 ms
76,656 KB
testcase_14 AC 71 ms
76,508 KB
testcase_15 AC 70 ms
76,000 KB
testcase_16 AC 71 ms
76,152 KB
testcase_17 AC 72 ms
76,660 KB
testcase_18 AC 71 ms
76,152 KB
testcase_19 AC 71 ms
76,400 KB
testcase_20 AC 69 ms
75,484 KB
testcase_21 AC 72 ms
76,372 KB
testcase_22 AC 72 ms
76,768 KB
testcase_23 AC 66 ms
74,380 KB
testcase_24 AC 65 ms
74,380 KB
testcase_25 AC 65 ms
74,380 KB
testcase_26 AC 66 ms
74,380 KB
testcase_27 AC 65 ms
74,380 KB
testcase_28 AC 65 ms
74,380 KB
testcase_29 AC 66 ms
74,380 KB
testcase_30 AC 66 ms
74,380 KB
testcase_31 AC 64 ms
74,380 KB
testcase_32 AC 65 ms
74,380 KB
testcase_33 AC 65 ms
74,380 KB
testcase_34 AC 378 ms
118,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

T = int(input())

n = [0] * T
m = [0] * T
for i in range(T):
    n[i], m[i] = input().split()

ans = []
for i in range(T):
    N = n[i][::-1]
    M = int(m[i])
    M *= 2

    p = 1

    a = 0
    for j in range(len(N)):
        a = (a + p*int(N[j])) % M
        p = (p * 10) % M

    ans.append((a*(a+1)//2) % (M // 2))

for x in ans:
    print(x)



0