SN祈祷中...

U334987 营救千泷の小翼龙

简要题意

给你一个数 ,求

策略分析

本题是一道纯纯诈骗题,我们打表或者运用数学归纳法都可以得到如下结论: 于是我们就可以直接带进去 算了,于是我们做完了,写代码时请注意取模。

参考代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <cstdio>
#define LL long long
using namespace std;

namespace SHAWN {
const int mod = 998244353;
LL n, v, ans;
int work()
{
cin >> n >> v;
n %= mod; v %= mod;
ans = (1 + n) * n / 2 % mod;
ans = ((ans * ans) % mod * v) % mod;
cout << ans << '\n';
return 0;
}
}

signed int main() {
ios :: sync_with_stdio(false);
cin.tie(nullptr);
return SHAWN :: work();
}