結果
| 問題 |
No.2683 Two Sheets
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-21 16:43:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 63 ms / 2,000 ms |
| コード長 | 636 bytes |
| コンパイル時間 | 2,185 ms |
| コンパイル使用メモリ | 196,232 KB |
| 最終ジャッジ日時 | 2025-02-20 10:39:05 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;
void fast_io() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
}
mint f(int H, int A) {
mint res;
for (int i = 0; i < H; i++) {
int L = max(0, i - A + 1);
int R = min(i, H - A);
mint add = mint(R - L + 1) / (H - A + 1);
add *= add;
res += add;
}
return res;
}
signed main(void) {
fast_io();
int H, W, A, B;
cin >> H >> W >> A >> B;
mint ans = mint(2) * A * B;
ans -= f(H, A) * f(W, B);
cout << ans.val() << endl;
return 0;
}