結果

問題 No.2683 Two Sheets
ユーザー nonon
提出日時 2024-03-20 21:35:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 2,154 ms
コンパイル使用メモリ 196,028 KB
最終ジャッジ日時 2025-02-20 08:50:11
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
mint P(long L, long K)
{
    mint res=mint(K)*(L-K+1);
    for(int i=1;i<K;i++)res+=2*mint(K-i)*(L-K+1-i);
    res/=L-K+1;
    res/=L-K+1;
    return res;
}
long H,W,A,B;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>H>>W>>A>>B;
    mint ans=2*mint(A)*B;
    ans-=P(H,A)*P(W,B);
    cout<<ans.val()<<endl;
}
0