0

グループの配列リストから取得する 3 つの整数の利用可能なすべてのチームの組み合わせでグループを作成できるプログラムを作成しようとしました。ここまででこの状態になりました

public static Integer organzieGroups(int groupSize,int teamSize) {
            Random rand =new Random();
        int count=0;
        ArrayList<Integer> group = new ArrayList<Integer>(groupSize);
    for (int i = 0; i <groupSize; i++) { 
        Integer r =rand.nextInt(groupSize);
        group.add(r);

        }
    System.out.println(" Just added and populated the group arraylist");
        ArrayList<Integer> team  = new ArrayList<Integer>(teamSize);

        int loopTimes=groupSize;
        Integer e=0;
        int i=0;
        int s=0;                
            for(i=0; i<loopTimes-1 ; i++){
                s=i+count;
                e = group.get(i)+ (group.get(i+1));
                System.out.println(e);
            }
            count++;
            loopTimes--;
            System.out.println(count + " " + loopTimes);

            if(count>loopTimes) {
                System.out.println("Solution Found");
                return e;
            }
            else
            {   System.out.println("Recursion Call");
                showTeams(groupSize,teamSize);
            }
            return e;
        }
        public static void main(String[] args) {

            Scanner siseInput= new Scanner(System.in);
            int groupSize;
            int teamSize;
                System.out.println("Type the group size you wish to create ");
                    groupSize= siseInput.nextInt();
                System.out.println(" The group will be of size : "+groupSize);
                System.out.println("Type the team size you wish to create ");
                    teamSize= siseInput.nextInt();
                System.out.println(" The team will be of size : "+teamSize);            
                        showTeams(groupSize,teamSize);
        }

}

どうすれば続行できるか、または間違った方向に進んでいるかどうかについてのアイデアはありますか?

4

0 に答える 0