Pagini recente » engineer | sudest | CERN | Diferente pentru problema/secvxor intre reviziile 7 si 2 | Diferente pentru problema/secretsanta intre reviziile 5 si 1
Nu exista diferente intre titluri.
Diferente intre continut:
== include(page="template/taskheader" task_id="secretsanta") ==
Christmas is just around the corner and John's colleagues decided to organize a Secret Santa.
According to Google, Secret Santa is a Western Christmas tradition in which members of a group or community are randomly assigned a person to whom they give a gift.
There are $N$ students in John's class (him included) and he is very curious to know the number of possible ways Secret Santa can be organized. The number John asks being big, you should output it modulo $10^9^ + 7$
Because there are a lot of John's on the planet, you will need to answer $Q$ queries regarding the possible ways Secret Santa can be organized in John's class. A valid way of organizing Secret Santa is a way such that no child gets gifts from two different children and there is no child who has to give a gift to himself/herself.
Poveste şi cerinţă...
h2. Date de intrare
The first line of the input file $secretsanta.in$ contains an integer $Q$, the number of queries.
Each of the following $Q$ lines contains an integer $N$.
Fişierul de intrare $secretsanta.in$ ...
h2. Date de ieşire
The output file $secretsanta.out$ will contain on each line the answer for the corresponding test case.
În fişierul de ieşire $secretsanta.out$ ...
h2. Restricţii
* $1 ≤ Q ≤ 10^5^$
* $2 ≤ N ≤ 10^5^$
* For tests worth $10$ points, $2 ≤ N ≤ 20$.
* For tests worth another $50$ points, the sum of all $N$ in the input doesn't exceed $200.000$.
* $... ≤ ... ≤ ...$
h2. Exemplu
table(example). |_. secretsanta.in |_. secretsanta.out |
| 4
5
6
9
12
| 44
265
133496
176214841
| This is some
text written on
multiple lines.
| This is another
text written on
multiple lines.
|
h3. Explicaţie
...
== include(page="template/taskfooter" task_id="secretsanta") ==
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.