include iostream include cstdio include algorithm include vector inclu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <queue>
#include <cstring>
using namespace std;
typedef long long ll;
const int N = 1000011;
const int P = 1000000007;
int mindel[N];
inline void erato(){
memset(mindel, 0, sizeof(mindel));
for (int i = 4; i < N; i += 2)
mindel[i] = 2;
for (int i = 3; i < N; i += 2) if (0 == mindel[i])
for (int j = i + i; j < N; j += i)
mindel[j] = i;
}
ll F[N];
int main(){
int n; cin >> n;
erato();
F[n] = 1;
F[n - 1] = 1;
for (int i = n - 2; i > 0; --i){
F[i] = (F[i + 1] + F[i + 2]) % P;
}
ll ans = 1;
for (int i = n; i > 1; --i){
if (0 == mindel[i]){
ans *= F[i] + 1;
ans %= P;\
}
else {
int A = mindel[i];
int B = i / mindel[i];
F[A] += F[i];
F[B] += F[i];
F[A] %= P;
F[B] %= P;
}
}
cout << ans << endl;
return 0;
}