版本比较
P7158 「dWoi R1」Password of Shady解
正文
增加 4 行删除 4 行
13 行未改动1415161718192021222324252 行未改动28293031323334353617 行未改动13 行未改动- **奇数个 k**:```dp1[i] = (dp1[i-1] * 9 + dp[i-1]) % mod。``````cpp#include<bits/stdc++.h>#define int long longusing namespace std;const int N=1e5+10;int dp[N],dp1[N];const int mod=998244353;signed main(){ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);2 行未改动for(int i=2;i<=N-10;i++){dp[i] = (dp[i-1] * 9 + dp1[i-1]) % mod;dp1[i] = (dp1[i-1] * 9 + dp[i-1]) % mod;}int t;cin>>t;while(t--){int n,k;17 行未改动13 行未改动1415161718192021222324252 行未改动28293031323334353617 行未改动13 行未改动- **奇数个 k**:```dp1[i] = (dp1[i-1] * 9 + dp[i-1]) % mod。``````cpp#include<bits/stdc++.h>#define int long longusing namespace std;const int N=1e5+10;int dp[N],dp1[N];const int mod=998244353;signed main(){ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);2 行未改动for(int i=2;i<=N-10;i++){dp[i] = (dp[i-1] * 9 + dp1[i-1]) % mod;dp1[i] = (dp1[i-1] * 9 + dp[i-1]) % mod;}int t;cin>>t;while(t--){int n,k;17 行未改动