about summary refs log tree commit diff
path: root/codechef/redone.c
blob: b73fe0e082449266e7e78bd3a88d7fad46cf7db8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <stdlib.h>

int main()
{
	long long *result = malloc(sizeof(long) * 1000001);
	result[0] = 1;
	for (long i = 1; i < 1000002; ++i)
		result[i] = result[i - 1] * (i + 1) % 1000000007;
	
	long t, n;
	scanf("%ld", &t);
	while (t--) {
		scanf("%ld", &n);
		printf("%ld\n", (result[n] - 1) % 1000000007);
	}
	
	return 0;
}