mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
28 lines
403 B
C
28 lines
403 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int q;
|
|
|
|
scanf("%d", &q);
|
|
|
|
while (q--) {
|
|
long long n;
|
|
|
|
scanf("%lld", &n);
|
|
|
|
if (n >= 2018) {
|
|
printf("0\n");
|
|
} else {
|
|
int ans = 1;
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
ans = (long long)ans * i % 2018;
|
|
}
|
|
|
|
printf("%d\n", ans);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|