結果
問題 |
No.2649 [Cherry 6th Tune C] Anthem Flower
|
ユーザー |
![]() |
提出日時 | 2024-02-23 22:06:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 353 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 79,084 KB |
最終ジャッジ日時 | 2024-09-29 06:47:06 |
合計ジャッジ時間 | 4,601 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 11 RE * 21 |
ソースコード
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)