-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import java.util.Scanner; | ||
|
||
public class 斐波那契数列 { | ||
public static void main(String[] args) { | ||
Scanner scan = new Scanner(System.in); | ||
int n = scan.nextInt(); | ||
System.out.println(isFibonacci(n)); | ||
} | ||
public static int isFibonacci(int n){ | ||
int a = 1, b = 1, c = 0; | ||
if (n == 1 || n == 2){ | ||
return 1; | ||
}else{ | ||
for (int i = 3; i <= n; i++) { | ||
c = a + b; | ||
a = b; | ||
b = c; | ||
} | ||
return c; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import java.util.Scanner; | ||
|
||
public class 递归打印数字的每一位 { | ||
public static void main(String[] args) { | ||
Scanner scan = new Scanner(System.in); | ||
int n = scan.nextInt(); | ||
func1(n); | ||
} | ||
public static int[] func1(int n){ | ||
int i = 0; | ||
int[] arr = new int[100]; | ||
if (n < 10){ | ||
arr[i] = n; | ||
return arr; | ||
}else{ | ||
arr[i] = n % 10; | ||
i++; | ||
return n /= 10; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ public static int func(int n){ | |
if (n <= 9){ | ||
return n; | ||
}else { | ||
return | ||
return n % 10 + func(n / 10); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
public class 自己造一个对象 { | ||
class girlfriend{ | ||
public String name; | ||
public String Englishname; | ||
public int age; | ||
public int height; | ||
public int weight; | ||
public String number; | ||
public String address; | ||
|
||
public void responde1(){ | ||
System.out.println("早安"); | ||
} | ||
public void responde2(){ | ||
System.out.println("午安"); | ||
} | ||
public void responde3(){ | ||
System.out.println("晚安"); | ||
} | ||
public void responde4(){ | ||
System.out.println("啊哈哈哈哈哈哈,憨憨"); | ||
} | ||
public void responde5(){ | ||
System.out.println("小狐狸~"); | ||
} | ||
public void responde6(){ | ||
System.out.println("憨批"); | ||
} | ||
} | ||
public static void main(String[] args) { | ||
girlfriend the_little_prince = new girlfriend(); | ||
the_little_prince.name = "绾"; | ||
the_little_prince.Englishname = "Isbella"; | ||
the_little_prince.age = 19; | ||
the_little_prince.height = 168; | ||
the_little_prince.weight = 103; | ||
the_little_prince.number = "62"; | ||
the_little_prince.address = "CA"; | ||
|
||
the_little_prince.responde1(); | ||
} | ||
} |