-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path10844.cpp
More file actions
41 lines (36 loc) · 858 Bytes
/
Copy path10844.cpp
File metadata and controls
41 lines (36 loc) · 858 Bytes
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
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int input=0;
cin>>input;
long long int result[10]={0};
long long int mod=1000000000;
long long int tmp[10]={0};
for(int i=1;i<=input;i++){
if(i==1){
for(int j=1;j<=9;j++){
result[j]=1;
}
}
else{
for(int j=0;j<=9;j++){
tmp[j]=result[j];
}
for(int j=0;j<=9;j++){
if(j==0) result[0]=tmp[1]%mod;
else if(j==9) result[9]=tmp[8]%mod;
else result[j]=(tmp[j-1]+tmp[j+1])%mod;
}
}
}
long long int sum=0;
for(int i=0;i<=9;i++){
sum=(sum+result[i])%mod;
}
cout<<sum<<'\n';
return 0;
}