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 | 29 | 30 |
Tags
- English
- 원서읽기
- D4
- SQL
- 쉬운 알고리즘 문제
- STUDYENGLISH
- the midnight library
- 코딩테스트
- dfs
- sw expert
- 원서읽자
- 코테 대비
- 백준
- readingbook
- BFS
- MySQL
- englishbook
- 삼성
- 프로그래머스
- 코테 준비
- 직무면접
- 알고리즘
- PyQt
- sw expert academy
- 완전탐색
- swexpertacademy
- 코테
- 알고리즘 문제
- 원서
- nightroutine
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
JUNGOL
www.jungol.co.kr
728x90
'알고리즘 > 정올' 카테고리의 다른 글
1341. 구구단 2 (0) | 2020.12.10 |
---|---|
1291. 구구단 (0) | 2020.12.10 |
Comments