結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー 👑 timitimi
提出日時 2024-02-23 21:42:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 795 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,068 KB
最終ジャッジ日時 2024-02-23 21:42:52
合計ジャッジ時間 9,471 ms
ジャッジサーバーID
(参考情報)
judge16 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 637 ms
75,740 KB
testcase_02 AC 658 ms
75,740 KB
testcase_03 AC 633 ms
75,740 KB
testcase_04 AC 652 ms
75,740 KB
testcase_05 AC 764 ms
75,868 KB
testcase_06 AC 795 ms
75,868 KB
testcase_07 AC 97 ms
75,740 KB
testcase_08 AC 95 ms
75,740 KB
testcase_09 AC 64 ms
70,748 KB
testcase_10 AC 65 ms
70,748 KB
testcase_11 AC 45 ms
59,836 KB
testcase_12 AC 53 ms
59,836 KB
testcase_13 AC 77 ms
76,792 KB
testcase_14 AC 77 ms
76,516 KB
testcase_15 AC 107 ms
76,132 KB
testcase_16 AC 79 ms
76,288 KB
testcase_17 AC 78 ms
76,660 KB
testcase_18 AC 77 ms
76,052 KB
testcase_19 AC 76 ms
76,280 KB
testcase_20 AC 75 ms
77,020 KB
testcase_21 AC 79 ms
76,400 KB
testcase_22 AC 78 ms
76,904 KB
testcase_23 AC 72 ms
77,068 KB
testcase_24 AC 72 ms
77,068 KB
testcase_25 AC 71 ms
77,068 KB
testcase_26 AC 70 ms
77,068 KB
testcase_27 AC 72 ms
77,068 KB
testcase_28 AC 71 ms
77,068 KB
testcase_29 AC 71 ms
77,068 KB
testcase_30 AC 71 ms
77,068 KB
testcase_31 AC 71 ms
77,068 KB
testcase_32 AC 71 ms
77,068 KB
testcase_33 AC 70 ms
77,068 KB
testcase_34 AC 604 ms
75,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for i in range(T):
  #D,A=map(int,input().split())
  N,M=input().split()
  #N=int(input())
  #X=list(map(int, input().split()))
  M=int(M)
  #ansb=((1+NN)*NN//2)%M
  M*=2 
  now=0;p=1  
  for s in N[::-1]:
    s=int(s)
    now+=p*s 
    now%=M 
    p*=10
    p%=M 
  d=(now*(now+1))
  ans=d%M 
  print(ans//2)
  
0