結果

問題 No.2685 Cell Proliferation (Easy)
ユーザー 👑 potato167potato167
提出日時 2024-03-21 12:04:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 720 bytes
コンパイル時間 4,723 ms
コンパイル使用メモリ 271,216 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-21 12:04:40
合計ジャッジ時間 5,971 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 3 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 3 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
#define rep(i,a,b) for(int i=a;i<b;i++)
using mint=modint998244353;
int main(){
	int a,b,c,d,T;
	cin>>a>>b>>c>>d>>T;
	mint P=mint(a)/mint(b);
	mint Q=mint(c)/mint(d);
	vector<mint> X(T+1,1);
	rep(i,0,T) X[i+1]=X[i]*Q.pow(i+1);
	vector<mint> dp(T+1);
	dp[0]=1;
	auto f=[&](auto self,int l,int r) -> void {
		if(l+1==r) return;
		int m=(l+r)/2;
		self(self,l,m);
		vector<mint> A(m-l),B(r-l);
		rep(i,l,m) A[i-l]=dp[i];
		rep(i,1,r-l) B[i]=X[i-1]*P;
		auto C=convolution(A,B);
		rep(i,m-l,r-l) dp[i+l]+=C[i];
		self(self,m,r);
	};
	f(f,0,T+1);
	mint ans=0;
	for(int i=T;i>=0;i--){
		ans+=dp[i]*X[T-i];
	}
	cout<<ans.val()<<"\n";
}
0