mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
28 lines
454 B
C++
28 lines
454 B
C++
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
int arr[41];
|
||
|
void init()
|
||
|
{
|
||
|
int i;
|
||
|
arr[0] = 1;
|
||
|
for(i = 1; i<41; i++)
|
||
|
arr[i] = (i*arr[i-1])%2009;
|
||
|
}
|
||
|
int main(int argc, char* argv[])
|
||
|
{
|
||
|
int t;
|
||
|
init();
|
||
|
while(1)
|
||
|
{
|
||
|
if(scanf("%d", &t)==EOF)
|
||
|
break;
|
||
|
if(t>=41)
|
||
|
{
|
||
|
printf("0\n");
|
||
|
continue;
|
||
|
}
|
||
|
printf("%d\n", arr[t]);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|