Advertisement
wojiaocbj

Untitled

Jun 14th, 2022
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. /*
  2.  Author: 曹北健
  3.  Result: AC    Submission_id: 3391572
  4.  Created at: Mon Apr 19 2021 16:21:32 GMT+0800 (China Standard Time)
  5.  Problem_id: 1068    Time: 0    Memory: 1620
  6. */
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <math.h>
  10. #include <string.h>
  11. #include <ctype.h>
  12. #include <time.h>
  13. typedef long long LL;
  14. typedef unsigned long long ULL;
  15. LL fac[1010] = {0};
  16. #define MOD 10000007
  17. void init(){
  18.     int i = 1;
  19.     fac[1] = 1;fac[2] = 2;
  20.     for(i = 3;i <= 1000;i += 2){
  21.         fac[i] = (i * fac[i - 2]) % MOD;
  22.     }
  23.     for(i = 4;i <= 1000;i += 2){
  24.         fac[i] = (i * fac[i - 2]) % MOD;
  25.     }
  26. }
  27. int main(){
  28. #ifdef _DEBUG
  29.     FILE *fp = freopen("input.txt","r",stdin);
  30.     if(!fp){
  31.         fp = fopen("input.txt","w");
  32.         fclose(fp);
  33.         return 1;
  34.     }
  35. #endif
  36.     init();
  37.     int n,i;
  38.     scanf("%d",&n);
  39.     while(n--){
  40.         scanf("%d",&i);
  41.         printf("%lld\n",fac[i]);
  42.     }
  43. #ifdef _DEBUG
  44.     fp = freopen("CON","r",stdin);
  45.     system("pause");
  46. #endif // _DEBUG
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement