Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.LinkedList;
- import java.util.List;
- import java.util.Scanner;
- public class Main2 {
- Scanner sc = new Scanner(System.in);
- ArrayList<List<Integer>> permutations = new ArrayList<>();
- void run(){
- int cases = sc.nextInt();
- for (int i = 0; i < cases; i++){
- ArrayList<Integer> initial = new ArrayList<>();
- for (int j = 0; j < 4; j++){
- initial.add(sc.nextInt());
- }
- permute(new ArrayList<Integer>(), initial);
- }
- }
- void permute(List<Integer> out, List<Integer> in){
- if (in.size() == 0){
- permutations.add(out);
- System.out.println(out.toString());
- } else {
- for (int i = 0; i < in.size(); i++){
- int n = in.get(i);
- ArrayList<Integer> newIn = new ArrayList<>(in);
- ArrayList<Integer> newOut = new ArrayList<>(out);
- newIn.remove(i);
- newOut.add(n);
- permute(newOut, newIn);
- }
- }
- }
- void check24(){
- boolean check = false;
- for (List l ; permutations){
- check = checkGroup1(l);
- if(check == true) {
- return;
- }
- }
- }
- boolean checkGroup1(List l , ){
- }
- public static void main(String[] args) {
- new Main2().run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement