1 条题解
-
0
【超长篇!一篇文章讲懂生成函数!】【那些你可能忘记了的算法5】生成函数&例题&卷积-CSDN博客
#include <bits/stdc++.h> #define LL long long using namespace std; const LL P = 10007; char s[510]; LL qpow(LL a, LL b) { int res = 1; for (; b; b >>= 1, a = a * a % P) if (b & 1) res = (res * a) % P; return res; } int main() { scanf("%s", s); LL n = 0, len = strlen(s); for (int i = 0; i < len; i++) n = (n * 10 % P + s[i] - '0') % P; LL ans = n * (n + 1) % P * (n + 2) % P * qpow(6LL, P - 2) % P; printf("%lld\n", ans); return 0; }

- 1
信息
- ID
- 4693
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 6
- 标签
- 递交数
- 49
- 已通过
- 16
- 上传者