結果

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

ソースコード

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&&L-K+1-i>=0;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