public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int a = cin.nextInt(); int temp; for (int n=0; n<a; n++) { temp = cin.nextInt(); System.out.println(Fibonacci(temp)); } } public static int Fibonacci(int n) { if (n == 1) { return 1; }else if (n == 2){ return 1; } else { return Fibonacci(n-1) + Fibonacci(n-2); } } }
public class Main_13 { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int a = cin.nextInt(); int temp; while (a>0) { temp = cin.nextInt(); System.out.println(Fibonacci(temp)); a--; }
cin.close(); } public static int Fibonacci(int n) { if (n == 1) { return 1; }else if (n == 2){ return 1; } else { return Fibonacci(n-1) + Fibonacci(n-2); } } }
public class Main { public static Scanner cin=new Scanner(System.in); public static void main(String[] args) { int line = 0; int number = cin.nextInt(); for(int i = 0; i < number; i++){ line = cin.nextInt(); System.out.println(f(line)); } }
static int f(int i){ if (i <= 2 && i >= 0 ) { return 1; } return f(i - 1) + f(i - 2); } }
public class Main{ public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException{ int lineNum = Main.readInt(); int f1 = 1; int f2 = 1; int fn = 0; for(int i = 0; i < lineNum; i++){ int num = Main.readInt(); if(num <= 2){ System.out.println(f1); }else{ f1 = 1; f2 = 1; for(int j = 3; j <= num; j++){ fn = f1 + f2; f1 = f2; f2 = fn; } System.out.println(fn); } } in.close(); } public static int readInt() throws IOException{ String str = in.readLine(); int num = Integer.parseInt(str); return num; } }