#K83837. Timetable Arrangements

    ID: 36286 Type: Default 1000ms 256MiB

Timetable Arrangements

Timetable Arrangements

This problem asks you to compute the number of valid timetables that can be arranged for a given number of topics. A valid timetable is simply a permutation of the topics. Therefore, for a given number n of topics, the number of valid timetables is n! (n factorial) computed modulo \(10^9+7\).

Mathematical Formulation:

Given an integer \(n\), the answer is

\[ \text{Answer} = n! \mod (10^9 + 7)\]

You will be given multiple test cases in which you need to compute the result for each test case.

inputFormat

The input is read from standard input (stdin). The first line contains an integer (t) (the number of test cases). Each of the following (t) lines contains a single integer (n) representing the number of topics.

outputFormat

For each test case, output a single line containing one integer: the number of valid timetables (i.e., (n!) modulo (10^9+7)). The output should be written to standard output (stdout).## sample

1
1
1