結果
問題 | No.1552 Simple Dice Game |
ユーザー | nok0 |
提出日時 | 2021-06-18 20:24:36 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 142 ms / 2,500 ms |
コード長 | 466 bytes |
コンパイル時間 | 2,363 ms |
コンパイル使用メモリ | 203,076 KB |
実行使用メモリ | 5,012 KB |
最終ジャッジ日時 | 2023-09-04 22:11:49 |
合計ジャッジ時間 | 5,107 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,384 KB |
testcase_03 | AC | 138 ms
4,868 KB |
testcase_04 | AC | 1 ms
4,384 KB |
testcase_05 | AC | 2 ms
4,384 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 108 ms
4,748 KB |
testcase_10 | AC | 126 ms
5,012 KB |
testcase_11 | AC | 128 ms
4,856 KB |
testcase_12 | AC | 37 ms
4,388 KB |
testcase_13 | AC | 108 ms
4,608 KB |
testcase_14 | AC | 64 ms
4,380 KB |
testcase_15 | AC | 80 ms
4,384 KB |
testcase_16 | AC | 13 ms
4,384 KB |
testcase_17 | AC | 19 ms
4,384 KB |
testcase_18 | AC | 98 ms
4,416 KB |
testcase_19 | AC | 140 ms
5,012 KB |
testcase_20 | AC | 141 ms
4,868 KB |
testcase_21 | AC | 142 ms
4,956 KB |
testcase_22 | AC | 141 ms
4,912 KB |
testcase_23 | AC | 141 ms
4,868 KB |
ソースコード
#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; vector<mint> pow_t(m + 1); for(int i = 0; i <= m; i++) pow_t[i] = mint(i).pow(n); for(int diff = 1; diff < m; diff++) { mint tmp = pow_t[diff + 1] - pow_t[diff] * 2 + pow_t[diff - 1]; res += tmp * diff * (m - diff); } res *= n; res *= m + 1; res /= 2; cout << res.val() << '\n'; }