版本比较
代码源考试总结5
正文
增加 33 行删除 1 行
411 行未改动全部展开41241341441541641641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145295 行未改动411 行未改动全部展开
#### 补题代码
```cpp其实没补题也是显然的。#include <bits/stdc++.h> #define int long longusing namespace std;
const int MOD = 998244353;int T;
int qpow(int x, int y) { int ans = 1; while(y) { if(y & 1) { ans = ans * x % MOD; } x = x * x % MOD; y >>= 1; } return ans;}
signed main() { freopen("Crazy.in", "r", stdin); freopen("Crazy.out", "w", stdout); cin >> T; while(T--) { int n, k; cin >> n >> k; int d = __gcd(n, k), w = (qpow(2, n / d) - 1 + MOD) % MOD; cout << (qpow(w, d) + d * qpow(w, d - 1) % MOD) % MOD << "\n"; } return 0;}```
#### 复杂度
95 行未改动