結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー yupoohyupooh
提出日時 2024-02-23 22:06:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,908 KB
最終ジャッジ日時 2024-02-23 22:06:29
合計ジャッジ時間 4,604 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,332 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 60 ms
72,752 KB
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 54 ms
69,172 KB
testcase_31 WA -
testcase_32 RE -
testcase_33 RE -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
t=int(input())
for _ in range(t):
  n,m=map(str,input().split())
  m=int(m)
  le=len(n)
  po=(10**20)%m
  now=1
  ans=0
  for i in range(le//20):
    s=int(n[le-20*(i+1):le-20*i])
    ans+=(s*now)%m
    ans%=m
    now*=po
    now%=m
  s=int(n[:le%20])
  ans+=(s*now)%m
  ans%=m
  ans=(ans*(ans+1))//2
  print(ans%m)
0