0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-28 03:16:28 +00:00

P7158 「dWoi R1」Password of Shady

R44423595
This commit is contained in:
Baoshuo Ren 2020-12-30 16:05:08 +08:00 committed by Baoshuo Ren
parent 7e6f998ec6
commit cda7fd96f7
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

23
problem/P7158/P7158.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int t, n, k;
long long f[100005], g[100005];
int main() {
scanf("%d", &t);
f[1] = 8;
g[1] = 1;
for (int i = 2; i <= 100000; i++) {
f[i] = (f[i - 1] * 9 + g[i - 1]) % mod;
g[i] = (g[i - 1] * 9 + f[i - 1]) % mod;
}
while (t--) {
scanf("%d%d", &n, &k);
printf("%lld\n", n == 1 ? 9 : f[n]);
}
return 0;
}