結果

問題 No.1552 Simple Dice Game
ユーザー nok0nok0
提出日時 2021-05-14 21:24:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 416 ms / 2,500 ms
コード長 400 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 202,384 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-04 22:07:23
合計ジャッジ時間 8,442 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,508 KB
testcase_03 AC 407 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 318 ms
4,380 KB
testcase_10 AC 372 ms
4,380 KB
testcase_11 AC 375 ms
4,384 KB
testcase_12 AC 108 ms
4,384 KB
testcase_13 AC 319 ms
4,384 KB
testcase_14 AC 186 ms
4,384 KB
testcase_15 AC 235 ms
4,380 KB
testcase_16 AC 34 ms
4,384 KB
testcase_17 AC 54 ms
4,380 KB
testcase_18 AC 289 ms
4,380 KB
testcase_19 AC 414 ms
4,380 KB
testcase_20 AC 415 ms
4,380 KB
testcase_21 AC 415 ms
4,384 KB
testcase_22 AC 413 ms
4,384 KB
testcase_23 AC 416 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

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

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