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
public class Test { | |
public static int fibonacci(int inPut) { | |
int result = 0; | |
if (inPut <= 2) { | |
result = 1; | |
}else{ | |
result += fibonacci(inPut -1 ) + fibonacci(inPut - 2); |
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
public class Test { | |
public static boolean isDaffodils(int inPut){ | |
int a1 = inPut % 10 ; //個位 | |
int a2 = ( inPut / 10 ) % 10 ; //十位 | |
int a3 = inPut /100 ;//百位 | |
double sum = Math.pow(a1,3) + Math.pow(a2,3) + Math.pow(a3,3); | |
if (inPut == sum) { |
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
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class Calc { | |
public String calc(String s) { | |
// TODO: 其實只能去掉 運算符號 前後的空白, 這邊先不管去掉所有的開始寫 | |
// TODO: 開頭為"-"的計算式, 會出錯 |
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
import java.util.Scanner; | |
public class Test { | |
public static int numAdd(String inPut, String inPut2){ | |
int result = 0; |
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
import java.util.Scanner; | |
public class Test { | |
public static boolean factorSum(int inPut){ | |
int result = 0; |
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
import java.util.Scanner; | |
public class Test { | |
public static float dropSum(int heigh , int times){ | |
float result = 0; | |
float temp = 0; |
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
package com.example.myapplication3.app; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.ListIterator; | |
public class Test { |
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
public class Test { | |
public static void main(String[] args) { | |
for (int i = 1; i < 10; i++) { | |
for (int j = 1; j < 10; j++) { | |
if (i*j <10 ) { | |
System.out.print(i + "*" + j + "= " + i*j + " | "); | |
}else{ | |
System.out.print(i + "*" + j + "=" + i*j + " | "); |
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
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
import java.util.Date; | |
public class Test { | |
public static void main(String[] args) { |
OlderNewer