标签:
import java.util.Scanner; public class Main { static int []f = new int [1000000]; static final int MOD = 10007; public static void main(String[] args) { // 用了一个公式(a+b)%c=(a%c+b%c)%c Scanner in = new Scanner(System.in); int n = in.nextInt(); f[0]=f[1]=1; for (int i = 2; i < n; i++) { f[i] = (f[i-1] % MOD + f[i-2] % MOD ) % MOD; } System.out.println(f[n-1]); } }
标签:
原文地址:http://www.cnblogs.com/LuckyZcy/p/5163934.html