File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ # [ Bronze III] 팩토리얼 - 10872
2
+
3
+ [ 문제 링크] ( https://www.acmicpc.net/problem/10872 )
4
+
5
+ ### 성능 요약
6
+
7
+ 메모리: 14140 KB, 시간: 108 ms
8
+
9
+ ### 분류
10
+
11
+ 구현, 수학
12
+
13
+ ### 제출 일자
14
+
15
+ 2025년 3월 21일 23:42:39
16
+
17
+ ### 문제 설명
18
+
19
+ <p >0보다 크거나 같은 정수 N이 주어진다. 이때, N!을 출력하는 프로그램을 작성하시오.</p >
20
+
21
+ ### 입력
22
+
23
+ <p >첫째 줄에 정수 N(0 ≤ N ≤ 12)이 주어진다.</p >
24
+
25
+ ### 출력
26
+
27
+ <p >첫째 줄에 N!을 출력한다.</p >
28
+
Original file line number Diff line number Diff line change
1
+ import java .io .*;
2
+
3
+
4
+ public class Main {
5
+ public static void main (String [] args ) throws IOException {
6
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
7
+ BufferedWriter bw = new BufferedWriter (new OutputStreamWriter (System .out ));
8
+ bw .write (String .valueOf (factorial (Integer .parseInt (br .readLine ()))));
9
+ bw .flush ();
10
+ bw .close ();
11
+ br .close ();
12
+ }
13
+
14
+ public static int factorial (int n ) {
15
+ return n <= 1 ? 1 : n * factorial (n - 1 );
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments