結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2024-02-23 22:20:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,468 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-02-23 22:20:59
合計ジャッジ時間 26,921 ms
ジャッジサーバーID
(参考情報)
judge15 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,984 KB
testcase_01 AC 1,397 ms
9,984 KB
testcase_02 AC 1,411 ms
9,984 KB
testcase_03 AC 1,410 ms
9,984 KB
testcase_04 AC 1,406 ms
9,984 KB
testcase_05 AC 1,468 ms
9,984 KB
testcase_06 AC 1,452 ms
9,984 KB
testcase_07 AC 98 ms
9,984 KB
testcase_08 AC 98 ms
9,984 KB
testcase_09 AC 42 ms
9,984 KB
testcase_10 AC 42 ms
9,984 KB
testcase_11 AC 29 ms
9,984 KB
testcase_12 AC 29 ms
9,984 KB
testcase_13 AC 417 ms
10,368 KB
testcase_14 AC 336 ms
10,368 KB
testcase_15 AC 266 ms
10,368 KB
testcase_16 AC 317 ms
10,368 KB
testcase_17 AC 587 ms
10,820 KB
testcase_18 AC 290 ms
10,496 KB
testcase_19 AC 402 ms
10,624 KB
testcase_20 AC 886 ms
11,008 KB
testcase_21 AC 419 ms
10,624 KB
testcase_22 AC 434 ms
10,660 KB
testcase_23 AC 922 ms
10,728 KB
testcase_24 AC 895 ms
10,728 KB
testcase_25 AC 924 ms
10,728 KB
testcase_26 AC 926 ms
10,728 KB
testcase_27 AC 921 ms
10,728 KB
testcase_28 AC 897 ms
10,728 KB
testcase_29 AC 921 ms
10,728 KB
testcase_30 AC 926 ms
10,728 KB
testcase_31 AC 920 ms
10,728 KB
testcase_32 AC 898 ms
10,728 KB
testcase_33 AC 920 ms
10,728 KB
testcase_34 AC 1,364 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(0)

t = int(input())

def nC2(n):
	return n*(n+1)//2
for _ in range(t):
	n,m = map(int,input().split())
	p = n//m
	d = n%m
	
	p %= m

	ans = (nC2(m-1) * p + nC2(d))%m
	
	print(ans)
0