问题描述
Java 代码实现
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a = 1;
int b = 1;
int sum = 1;
if (n < 3) {
System.out.println(1);
} else {
for (int i = 3; i <= n; ++i) {
sum = (a+b)%10007;
a = b;
b = sum;
}
System.out.println(b);
}
in.close();
}
}