为方便阅读,设共有 盏灯。
这 盏灯中的第 盏灯,在所有 种可能的开关组合中:
- 第 盏灯有两种情况:
- 亮,记为 。
- 暗,记为 。
- 由于每种状态出现的概率均等,且各位之间相互独立,所以第 盏灯为 的状态数量恰好占总状态数的一半。
- 因为总状态数为 ,所以第 盏灯状态为 的数量为 。
上述得每一盏灯在 个状态中都是 ,那么 盏灯在所有状态中 的总出现次数为:。
AC Code
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD=998244353;
int KSM(int a, int b) {
int res=1;
a%=MOD;
while (b>0) {
if (b&1) res=(res*a)%MOD;
a=(a*a)%MOD;
b>>=1;
}
return res;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n=2026;
int ans=(n % MOD*KSM(2,n-1))%MOD;
cout<<ans<<endl;
exit(0);
}
暂无评论