Download Algorithm_project/Case_module/src/Case4_package/Test.java from zxy0307/Java: direct link, hf CLI and curl.
- Browser
- Download file 563 Bytes
-
https://huggingface.co/zxy0307/Java/resolve/main/Algorithm_project/Case_module/src/Case4_package/Test.java
- Command line
-
hf download hf://zxy0307/Java/Algorithm_project/Case_module/src/Case4_package/Test.java
-
curl -L -o Test.java https://huggingface.co/zxy0307/Java/resolve/main/Algorithm_project/Case_module/src/Case4_package/Test.java
563 Bytes
| package Case4_package; | |
| public class Test { | |
| public static void main(String[] args) { | |
| /* | |
| 可爱的小明特别喜欢爬楼梯,他有时候一次爬一个台阶,有时候一次爬两个台阶。 | |
| 如果这个楼梯有100个台阶,小明一共有多少种爬法? | |
| */ | |
| System.out.println(getCount(20)); | |
| } | |
| public static int getCount(int n) { | |
| if (n == 1) { | |
| return 1; | |
| } | |
| if (n == 2) { | |
| return 2; | |
| } | |
| return getCount(n - 1) + getCount(n - 2); | |
| } | |
| } | |