250x250
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
- 원서읽자
- nightroutine
- 원서읽기
- dfs
- 원서
- 코테
- 백준
- englishbook
- 쉬운 알고리즘 문제
- 프로그래머스
- 알고리즘
- 삼성
- PyQt
- sw expert academy
- swexpertacademy
- STUDYENGLISH
- English
- 코딩테스트
- 코테 대비
- 직무면접
- the midnight library
- 알고리즘 문제
- BFS
- D4
- sw expert
- readingbook
- MySQL
- 완전탐색
- SQL
- 코테 준비
Archives
- Today
- Total
시나브로
1309. 팩토리얼 본문
728x90
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
void factoral(int n, long long answer) {
if (n == 0) {
cout << n + 1 << "! = " << n + 1 << endl;
cout << answer << endl;
return;
}
cout << n + 1 << "! = " << n + 1 << " * " << n << "!" << endl;
factoral(n - 1, answer * n);
}
int main() {
long long n = 0;
cin >> n;
factoral(n - 1, n);
return 0;
}
www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=589&sca=2080
728x90
'알고리즘 > 정올' 카테고리의 다른 글
1341. 구구단 2 (0) | 2020.12.10 |
---|---|
1291. 구구단 (0) | 2020.12.10 |
Comments