File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
| 차시 | 날짜 | 문제유형 | 링크 | 풀이 |
4
4
| :----:| :---------:| :----:| :-----:| :----:|
5
- | 1차시 | 2023.10.27 | BFS | - | - |
5
+ | 1차시 | 2024.03.12 | BFS | [ 숨바꼭질 ] ( https://www.acmicpc.net/problem/1697 ) | [ # 4 ] ( https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/4 ) |
6
6
---
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+ long long int stair_num[101 ][11 ]; // n번째자리에 m이왔을때 가능한 계단의수
4
+ int main (void ) {
5
+ ios_base::sync_with_stdio (false );
6
+ cin.tie (NULL );
7
+ int num;
8
+ cin >> num; // 첫째자리수는 0은 제외하고 어떤수가 오든 경우의수는 1이다.
9
+ for (int j = 1 ; j <= 9 ; j++)
10
+ stair_num[1 ][j] = 1 ;
11
+ for (int i = 2 ; i <=num; i++) { // 어떤자리수가 0일경우 그전자리수는 1이어야한다.
12
+ for (int j =0 ; j <10 ; j++) {
13
+ if (!j) stair_num[i][j] = stair_num[i - 1 ][1 ];
14
+ stair_num[i][j] = (stair_num[i - 1 ][j - 1 ] + stair_num[i - 1 ][j + 1 ])%1000000000 ;
15
+ }
16
+ }
17
+ long long int sum = 0 ;
18
+ for (int j = 0 ; j < 10 ; j++) { // 제일 마지막자리에 0~9 가 오는 경우의수들을 각각 다 더해준다.
19
+ sum += stair_num[num][j];
20
+ }
21
+ cout << sum%1000000000 ;
22
+ return 0 ;
23
+ }
You can’t perform that action at this time.
0 commit comments