# BZOJ4872: [Shoi2017]分手是祝愿【概率期望DP】【思维好题】

## Description

Zeit und Raum trennen dich und mich.

## Input

1 ≤ n ≤ 100000, 0 ≤ k ≤ n；

4 0
0 0 1 1

512

## 思路

#include<bits/stdc++.h>

using namespace std;

const int Mod = 1e5 + 3;
const int N = 1e5 + 10;

int n, k, a[N], f[N], fac = 1;

int add(int a, int b) {
return (a += b) >= Mod ? a - Mod : a;
}

int sub(int a, int b) {
return (a -= b) < 0 ? a + Mod : a;
}

int mul(int a, int b) {
return 1ll * a * b % Mod;
}

int fast_pow(int a, int b) {
int res = 1;
for (; b; b >>= 1, a = mul(a, a)) {
if (b & 1) res = mul(res, a);
}
return res;
}

int main() {
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
fac = mul(fac, i);
}
int num = 0;
for (int i = n; i >= 1; i--) {
for (int j = i << 1; j <= n; j += i) {
a[i] ^= a[j];
}
if (a[i]) ++num;
}
for (int i = 1; i <= k; i++) f[i] = 1;
for (int i = n; i > k; i--) {
f[i] = mul(add(n, mul(n - i, f[i + 1])), fast_pow(i, Mod - 2));
}
int ans = 0;
for (int i = 1; i <= num; i++) {
}