結果

問題 No.1552 Simple Dice Game
ユーザー nok0nok0
提出日時 2021-06-18 20:05:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 557 ms / 2,500 ms
コード長 416 bytes
コンパイル時間 5,759 ms
コンパイル使用メモリ 259,400 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-04 22:11:43
合計ジャッジ時間 13,827 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 545 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 428 ms
4,376 KB
testcase_10 AC 499 ms
4,380 KB
testcase_11 AC 502 ms
4,376 KB
testcase_12 AC 145 ms
4,380 KB
testcase_13 AC 426 ms
4,380 KB
testcase_14 AC 248 ms
4,380 KB
testcase_15 AC 314 ms
4,376 KB
testcase_16 AC 45 ms
4,380 KB
testcase_17 AC 72 ms
4,376 KB
testcase_18 AC 387 ms
4,376 KB
testcase_19 AC 555 ms
4,380 KB
testcase_20 AC 555 ms
4,376 KB
testcase_21 AC 557 ms
4,380 KB
testcase_22 AC 555 ms
4,380 KB
testcase_23 AC 556 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;

long long n;
int m;
mint res;
int main() {
	cin >> n >> m;
	for(int r = 1; r <= m; r++)
		res += (mint(r).pow(n) - mint(r - 1).pow(n)) * r;
	for(int l = 1; l <= m; l++)
		res -= (mint(m - l + 1).pow(n) - mint(m - l).pow(n)) * l;
	res *= n;
	res *= m + 1;
	res /= 2;
	cout << res.val() << '\n';
	return 0;
}
0