解题思路:
注意事项:
0! = 1
参考代码:
import java.util.Scanner; public class C1151 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int rs = F(sc.nextInt()); System.out.println(rs); } sc.close(); } private static int F(int n){ if(n <= 1) return 1; return F(n-1)*n; } }
0.0分
0 人评分