0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-16 20:05:26 +00:00

P3773 [CTSC2017]吉夫特

https://www.luogu.com.cn/record/80299079
This commit is contained in:
Baoshuo Ren 2022-07-19 20:30:33 +08:00
parent b634d12e32
commit 47aae6d79a
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

31
Luogu/P3773/P3773.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 233333 + 5;
const int mod = 1e9 + 7;
int n, f[N], ans;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1, x; i <= n; i++) {
cin >> x;
for (int j = x - 1 & x; j; j = j - 1 & x) {
f[j] = (f[j] + f[x] + 1) % mod;
}
ans = (ans + f[x]) % mod;
}
cout << ans << endl;
return 0;
}