結果
| 問題 |
No.2685 Cell Proliferation (Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-21 00:57:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 143 ms / 2,000 ms |
| コード長 | 1,019 bytes |
| コンパイル時間 | 801 ms |
| コンパイル使用メモリ | 80,656 KB |
| 最終ジャッジ日時 | 2025-02-20 10:21:41 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#include<iostream>
#include<algorithm>
#include<vector>
#include<atcoder/modint>
using namespace std;
using ll=long long;
using mint=atcoder::modint998244353;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<ll>P(2),Q(2);
for(int i=0;i<2;i++)cin>>P[i];
for(int i=0;i<2;i++)cin>>Q[i];
int T;
cin>>T;
vector<mint>dp(T+2);
dp[1]=1;
vector<mint>q(T+2);
q[0]=1;
for(int i=1;i<=T+1;i++)q[i]=q[i-1]*Q[0]/Q[1];
for(int i=0;i<T;i++){
for(int j=1;j<=T+1;j++){
dp[0]+=dp[j]*P[0]/P[1];
dp[j]*=q[j];
}
for(int j=T+1;j>=1;j--)dp[j]=dp[j-1];
dp[0]=0;
}
mint ans=0;
for(int i=1;i<=T+1;i++){
ans+=dp[i];
}
cout<<ans.val()<<"\n";
}