vot123 | 2016-05-12 06:52:37
Author
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int MOD = 1000000007;
int n = sc.nextInt();
int t = 0;
long[] f = new long[1000001];
long[] result = new long[n];
f[0] = 0;
f[1] = 1;
f[2] = 2;
for(int i=3; i<1000001; i++)
f[i] = (f[i - 1] + (i - 1)) * (f[i - 2]) % MOD;
while (t < n) {
int temp = sc.nextInt();
result[t++] = f[temp];
}
for (int i = 1 ; i <= n; i++) {
System.out.println("Case #" + i + ":\n" + result[i-1]);
}
}
}