結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー hato336hato336
提出日時 2024-02-23 22:03:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 368 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,576 KB
最終ジャッジ日時 2024-02-23 22:03:49
合計ジャッジ時間 10,046 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
85,176 KB
testcase_01 AC 252 ms
89,400 KB
testcase_02 AC 250 ms
89,400 KB
testcase_03 AC 242 ms
89,272 KB
testcase_04 AC 246 ms
89,272 KB
testcase_05 AC 362 ms
89,400 KB
testcase_06 AC 368 ms
89,400 KB
testcase_07 AC 188 ms
89,400 KB
testcase_08 AC 183 ms
89,400 KB
testcase_09 AC 161 ms
89,272 KB
testcase_10 AC 163 ms
89,144 KB
testcase_11 AC 131 ms
85,176 KB
testcase_12 AC 131 ms
85,176 KB
testcase_13 AC 193 ms
88,632 KB
testcase_14 AC 183 ms
88,760 KB
testcase_15 AC 178 ms
88,376 KB
testcase_16 AC 182 ms
88,888 KB
testcase_17 AC 200 ms
89,144 KB
testcase_18 AC 181 ms
88,504 KB
testcase_19 AC 191 ms
88,632 KB
testcase_20 AC 231 ms
90,936 KB
testcase_21 AC 201 ms
88,376 KB
testcase_22 AC 193 ms
88,760 KB
testcase_23 AC 231 ms
91,448 KB
testcase_24 AC 234 ms
91,320 KB
testcase_25 AC 232 ms
91,320 KB
testcase_26 AC 233 ms
91,320 KB
testcase_27 AC 232 ms
91,448 KB
testcase_28 AC 230 ms
91,448 KB
testcase_29 AC 237 ms
91,192 KB
testcase_30 AC 232 ms
91,576 KB
testcase_31 AC 231 ms
91,576 KB
testcase_32 AC 228 ms
91,448 KB
testcase_33 AC 230 ms
91,320 KB
testcase_34 AC 243 ms
89,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
sys.set_int_max_str_digits(0)
input = sys.stdin.readline
for i in range(int(input())):
    n,m =map(int,input().split())
    if n % 2 == 0:
        x = n//2
        print(((x%m)*(n+1)%m)%m)
    else:
        x = (n+1)//2
        print((x%m)*(n%m)%m)
0