Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
21
Task/Man-or-boy-test/Java/man-or-boy-test-1.java
Normal file
21
Task/Man-or-boy-test/Java/man-or-boy-test-1.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import java.util.function.DoubleSupplier;
|
||||
|
||||
public class ManOrBoy {
|
||||
|
||||
static double A(int k, DoubleSupplier x1, DoubleSupplier x2,
|
||||
DoubleSupplier x3, DoubleSupplier x4, DoubleSupplier x5) {
|
||||
|
||||
DoubleSupplier B = new DoubleSupplier() {
|
||||
int m = k;
|
||||
public double getAsDouble() {
|
||||
return A(--m, this, x1, x2, x3, x4);
|
||||
}
|
||||
};
|
||||
|
||||
return k <= 0 ? x4.getAsDouble() + x5.getAsDouble() : B.getAsDouble();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(A(10, () -> 1.0, () -> -1.0, () -> -1.0, () -> 1.0, () -> 0.0));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue