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.Arrays; | |
import java.util.function.IntPredicate; | |
import java.util.stream.IntStream; | |
class Scratch { | |
public static void main(String[] args) { | |
out(solve(new int[]{1, 2, 3, 4, 5, 6})); | |
out(solve(new int[]{0, 0, 0, 0, 0, 0})); | |
out(solve(new int[]{0, 0, 0, 1, 2, 3})); | |
out(solve(new int[]{1, 2, 3, 0, 0, 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.Arrays; | |
class Scratch { | |
public static void main(String[] args) { | |
System.out.println(solve(new int[]{1, 2, 3, 1}, 3)); | |
System.out.println(solve(new int[]{1, 0, 1, 1}, 1)); | |
System.out.println(solve(new int[]{1, 2, 3, 1, 2, 3}, 2)); | |
System.out.println(solve(new int[]{1, 2, 3, 1, 2, 3}, 3)); | |
System.out.println(solve(new int[]{-1, -2, -3, 1, 2, 3}, 3)); | |
System.out.println(solve(new int[]{-1, 2, -3, 1, 2, -3}, 3)); |
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.Arrays; | |
import java.util.stream.Collectors; | |
class Scratch { | |
public static void main(String[] args) { | |
solve(5); | |
} | |
private static void solve(int h) { | |
int w = 2 * h - 1; // ширина основания нашей пирамиды |
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
class Scratch { | |
public static void main(String[] args) { | |
solve(new int[][]{ | |
new int[]{6, 4, 10, 11}, | |
new int[]{2, 9, 9, 3}, | |
new int[]{5, 4, 5, 4}, | |
}); //25 | |
solve(new int[][]{ | |
new int[]{1, 1, 1}, |
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
class Scratch { | |
public static void main(String[] args) { | |
System.out.println(solve("A1-A1")); //false | |
System.out.println(solve("K1-H2")); //false | |
System.out.println(solve("H9-H2")); //false | |
System.out.println(solve("A1-K2")); //false | |
System.out.println(solve("A1-A9")); //false | |
System.out.println(solve("A1-B3")); //true | |
System.out.println(solve("B3-A1")); //true |
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.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
class Scratch { | |
public static void main(String[] args) { | |
out(new int[]{-1, 2, -1, 3, -4}); // -1 -1 -4 | |
out(new int[]{-1, -2, -1, 13, -4}); // 13 | |
out(new int[]{-1, -2, -1, -3, -4}); // -1 -2 -1 -3 -4 | |
out(new int[]{-1, 2}); // 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
import java.util.ArrayList; | |
import java.util.Comparator; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
public class Task137 { | |
public static void main(String[] args) { | |
System.out.println("1 = " + solve(1)); // 1 | |
System.out.println("2 = " + solve(2)); // 2 | |
System.out.println("10 = " + solve(10)); // 25 |
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
class Scratch { | |
public static void main(String[] args) { | |
System.out.println(findDeletedChar(new char[]{'a', 'b', 'c'}, new char[]{'c', 'b'})); // a | |
System.out.println(findDeletedChar(new char[]{'a', 'b', 'c'}, new char[]{'a', 'b'})); // c | |
System.out.println(findDeletedChar(new char[]{'a', 'b', 'c'}, new char[]{'a', 'c'})); // b | |
System.out.println(findDeletedChar(new char[]{'a', 'b', 'c'}, new char[]{'a', 'b'})); // c | |
System.out.println(findDeletedChar(new char[]{'a', 'b', 'c'}, new char[]{'b', 'c'})); // a | |
System.out.println(findDeletedChar(new char[]{'a', 'b', 'c', 'd'}, new char[]{'b', 'a', 'c'})); // d | |
} |
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
class Scratch { | |
public static void main(String[] args) { | |
System.out.println(solve(3, 2, 1)); // 6 | |
System.out.println(solve(3, 1, 1)); // 1 | |
System.out.println(solve(3, 1, 3)); // 3 | |
System.out.println(solve(3, 2, 3)); // 4 | |
System.out.println(solve(1, 1, 1)); // 1 | |
System.out.println(solve(3, 3, 3)); // 9 | |
System.out.println(solve(3, 3, 1)); // 7 |
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
class Scratch { | |
public static void main(String[] args) { | |
System.out.println(solve(3, 2, 1)); // 6 | |
System.out.println(solve(3, 1, 1)); // 1 | |
System.out.println(solve(3, 1, 3)); // 3 | |
System.out.println(solve(3, 2, 3)); // 4 | |
System.out.println(solve(1, 1, 1)); // 1 | |
System.out.println(solve(3, 3, 3)); // 9 | |
System.out.println(solve(3, 3, 1)); // 7 |