1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课外】7.数组1/7-19 数组-数学鬼才.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;
}