Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 스택
- 유니온 파인드
- 우선순위 큐
- 알고리즘
- 투 포인터
- c++
- 그래프
- 백트래킹
- 정렬
- DFS
- XR Interaction Toolkit
- 유니티
- 재귀
- 자료구조
- 백준
- 구현
- ue5
- 시뮬레이션
- 다익스트라
- 그리디 알고리즘
- 수학
- Team Fortress 2
- BFS
- VR
- Unreal Engine 5
- 문자열
- 브루트포스
- 다이나믹 프로그래밍
- 누적 합
- 트리
Archives
- Today
- Total
1일1알
백준 17478번 재귀함수가 뭔가요? C++ 본문
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#include <map>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <limits.h>
#include <bitset>
using namespace std;
using int64 = long long;
#define Print for (int i = 0; i < cnt; i++) cout << str;
int n;
string str = "____";
void Rec(int cnt) {
if (n == cnt) {
Print; cout << "\"재귀함수가 뭔가요?\"\n";
Print; cout << "\"재귀함수는 자기 자신을 호출하는 함수라네\"\n";
Print; cout << "라고 답변하였지.\n";
return;
}
Print; cout << "\"재귀함수가 뭔가요?\"\n";
Print; cout << "\"잘 들어보게. 옛날옛날 한 산 꼭대기에 이세상 모든 지식을 통달한 선인이 있었어.\n";
Print; cout << "마을 사람들은 모두 그 선인에게 수많은 질문을 했고, 모두 지혜롭게 대답해 주었지.\n";
Print; cout << "그의 답은 대부분 옳았다고 하네. 그런데 어느 날, 그 선인에게 한 선비가 찾아와서 물었어.\"\n";
Rec(cnt + 1);
Print; cout << "라고 답변하였지.\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
cout << "어느 한 컴퓨터공학과 학생이 유명한 교수님을 찾아가 물었다.\n";
Rec(0);
}
'알고리즘' 카테고리의 다른 글
백준 2437번 저울 C++ (1) | 2022.09.14 |
---|---|
백준 1939번 중량제한 C++ (0) | 2022.09.13 |
백준 5972번 택배 배송 C++ (0) | 2022.09.10 |
백준 1253번 좋다 C++ (0) | 2022.09.09 |
백준 24391번 귀찮은 해강이 C++ (0) | 2022.09.08 |