diff --git a/Main.java b/Main.java new file mode 100644 index 0000000..6c38fce --- /dev/null +++ b/Main.java @@ -0,0 +1,151 @@ +// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`, +// then press Enter. You can now see whitespace characters in your code. +public class Main { + public static long Fibonacci_Iter(int num){ + long smol = 1; + long big = 1; + long temp; + + while (1 < num){ + temp = smol; + smol = big; + big = big + temp; + num--; + } + return big; + } + public static long Fibonacci_Rec(int num){ + + // Inputqualität + if(num < 0){ + System.out.println("Ungültiger Input"); + return 0; + } + + if(num < 2){ + return 1; + } + + return Fibonacci_Rec(num-2) + Fibonacci_Rec(num-1); + } + public static long Fibonacci_Round(int num){ + long result = 1; + if(num==0 || num==1){return 1;} + for(int i=1; i= 0) { + field[row-col + i][i]=3; + } + + // Left 2 Right, Bottom 2 Top + if(row+i < 8 && row+i >=0 && col-i < 8 && col-i >=0){ + field[row+i][col-i]=3; + } + if(row-i < 8 && row-i >=0 && col+i < 8 && col+i >=0){ + field[row-i][col+i]=3; + } + } + // place queen + field[row][col]=1; + } + public static boolean QueensFree(int field[][], int row, int col){ + return field[row][col] == 0; + } + public static void QueensPrint(int field[][]){ + // print field + System.out.println("---------------"); + for(int i=0; i0){ + boolean full = true; + for(int i=0;i