:: ADVANCE ::
107일차 1. upstair 본문
반응형
107일차 1. 9단계 재귀호출 upstair
http://183.106.113.109/30stair/upstair/upstair.php?pname=upstair
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 |
#include <iostream>
using namespace std;
int cnt;
void upstair(int n, int end)
{
if(n == end) {
cnt++;
return ;
}
if(n > end) {
return ;
}
upstair(n+1, end);
upstair(n+2, end);
return ;
}
int main(void)
{
int n;
cin >> n;
upstair(1, n);
upstair(2, n);
cout << cnt << endl;
return 0;
} |
반응형
'Algorithm > 일일알고리즘' 카테고리의 다른 글
109일차 1. hangover (0) | 2014.10.28 |
---|---|
106일차 1. lab (0) | 2014.10.23 |
98일차 2. coci_obilazak (0) | 2014.10.14 |
98일차 1. mgcd (0) | 2014.10.14 |
97일차 1. self_number (0) | 2014.10.13 |
Comments