Java 代码
import java.util.Scanner;
public class Main
{
public static int fib(int n)
{
if (n == 1 || n == 2)
return 1;
else
return fib (n - 2) + fib (n -1 );
}
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
System.out.println (fib (n));
}
}