Skip to content

Commit

Permalink
2024-02-15
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkms committed Feb 15, 2024
1 parent 82c6feb commit 8cbc65c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions rivkms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
| μ°¨μ‹œ | λ‚ μ§œ | λ¬Έμ œμœ ν˜• | 링크 | 풀이 |
|:----:|:---------:|:----:|:-----:|:----:|
| 1μ°¨μ‹œ | 2024.02.12 | DP | [ν‰λ²”ν•œ λ°°λ‚­](https://www.acmicpc.net/problem/12865) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5) |
| 2μ°¨μ‹œ | 2024.02.15 | Recursion | [ν•˜λ…Έμ΄ 탑 이동 μˆœμ„œ](https://www.acmicpc.net/problem/11729) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/8) |
---
30 changes: 30 additions & 0 deletions rivkms/Recursion/11729.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <iostream>
#include <vector>
using namespace std;

vector<pair<int, int>> box;

void func(const int & start, const int & center, const int & end, const int & n){
if(n==1){
box.push_back(pair<int, int> (start, end));
return;
}
func(start, end, center, n-1);
box.push_back(pair<int, int> (start, end));
func(center, start, end, n-1);

return;
}

int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n, a = 0;
cin >> n;
func(1,2,3,n);
cout << box.size() << "\n";
for(pair<int, int> i : box){
cout << i.first << " " << i.second << "\n";
}

return 0;
}

0 comments on commit 8cbc65c

Please sign in to comment.