Skip to content

Commit

Permalink
日常练习
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunbeam-5 committed Oct 18, 2022
1 parent 58966e4 commit 4c93c74
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 20221017/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions 20221017/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 20221017/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions 20221017/.idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 20221017/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 20221017/20221017.iml
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>
Binary file not shown.
26 changes: 26 additions & 0 deletions 20221017/src/demo1/Brackets.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package demo1;

public class Parenthesis {
public boolean chkParenthesis(String A, int n) {
// write code here
if (n % 2 == 1){
return false;
}else {
char[] array = A.toCharArray();
for (int i = 0; i < array.length; i++) {
if (array[i] == '(' || array[i] == ')'){
continue;
}else {
return false;
}
}
return true;
}
}
}

public class Brackets {
public static void main(String[] args) {

}
}
22 changes: 22 additions & 0 deletions 20221017/src/demo1/Fibonacci.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package demo1;

import java.util.Scanner;

public class Fibonacci {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();
int n = 0;
int f1 = 0, f2 = 1, f3 = 0;
while (f3 < m){
f3 = f1 + f2;
f1 = f2;
f2 = f3;
}
if (m - f1 > f2 - m){
System.out.println(f2-m);
}else {
System.out.println(m-f1);
}
}
}

0 comments on commit 4c93c74

Please sign in to comment.