結果

問題 No.2807 Have Another Go (Easy)
ユーザー t98slider
提出日時 2024-07-19 07:45:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 659 bytes
コンパイル時間 3,730 ms
コンパイル使用メモリ 252,584 KB
最終ジャッジ日時 2025-02-23 16:14:13
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    const int r = n * m;
    vector<mint> dp(n * m + 13), tb(n * m);
    dp[0] = 1;
    for(int i = 0; i < n * m; i++){
        for(int j = 1; j <= 6; j++){
            dp[i + j] += dp[i];
            tb[i + 1] += dp[i + j];
        }
    }
    while(k--){
        int v;
        cin >> v;
        mint ans = dp[v] * tb[r - v] + dp[n + v] * tb[r - (n + v)];
        ans -= dp[v] * dp[n] * tb[r - (n + v)];
        cout << ans.val() << '\n';
    }
}
0