Solution -「GLR-R3」A
Rainybunny · · 题解
\mathscr{Description}
[Link](). (It's empty temporarily.)
给定
\mathscr{Solution}
简化一个巨难的 idea,得到了 T1 qwq。
\mathscr{Subtasks}
Subtask 1 考察选手动手能力,并借此鼓励选手 OEIS。(
Subtask 2 考察 std::next_permutation 的使用,并借此让选手笃定 OEIS 结果。(
Subtask 3 献给
Subtask 4 献给朴素的
Subtask 5 献给正解,献给所有参赛选手。
\mathscr{Body}
其实它是 A005329,但因为是 T1 所以就不要在意细节了 awa。
考虑 DP,令
进一步,从
于是,答案
如果有花里胡哨爱好者, 可以快速
\mathscr{Code}
/*+Rainybunny+*/
#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
int main() {
int n, ans = 1, pwr = 1;
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
(pwr <<= 1) >= MOD && (pwr -= MOD);
ans = ans * (pwr - 1ll) % MOD;
}
printf("%d\n", ans);
return 0;
}