Dear visitor, welcome to MastersForum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
![]() |
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
abcdef ab cd ef ab ce df ab cf de ac bd ef ac be df ac bf de ad bc ef ad be cf ad bf ce ae bc df ae bd cf ae bf cd af bc de af bd ce af be cd |
This post has been edited 1 times, last edit by "kOa_Borgg" (Jun 9th 2005, 5:36pm)
![]() |
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
public class calcPoss { public static void main(String[] args) { int spielerAnz=12; String[][] arr=new String[spielerAnz][spielerAnz]; String[] buchst=new String[]{"A","B","C","D","E","F","G","H","I","J","K","L"}; //Array mit allen möglichkeiten erstellen for (int i=0;i<spielerAnz;i++) { for ( int j=0;j<spielerAnz;j++) { arr[i][j]=buchst[i]; String stri=arr[i][j].concat(buchst[j]); arr[i][j]=stri; System.out.print(" "+arr[i][j]); } System.out.print("\n"); } //Array zusammenfassen Vector vec=new Vector(); for (int i=0;i<spielerAnz;i++) { for ( int j=0;j<spielerAnz;j++) { if(j<=i)//gleichgerade { if (!vec.contains(arr[i][j])) { vec.add(arr[i][j]); } } } } System.out.println("Anzahl unterschiedlicher Teams= "+vec.size()); for ( int j=0;j<vec.size();j++) { System.out.println("Value= "+vec.get(j)); } } } |
This post has been edited 1 times, last edit by "-=)GWC(RaMsEs" (Jun 9th 2005, 5:31pm)
Quoted
Original von GEC|Napo
nein einfach nur in n-1 einsetzen. Würde es ja gerne mathematisch korrekt aufschreiben, aber dazu fehlen mir die Zeichen.
ich habe nur 29 Möglichkeiten aufgezählt, weil es genügte um die Behauptung zu wiederlegen.
This post has been edited 1 times, last edit by "kOa_Borgg" (Jun 9th 2005, 5:42pm)