Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: 曹北健
- Result: AC Submission_id: 3391572
- Created at: Mon Apr 19 2021 16:21:32 GMT+0800 (China Standard Time)
- Problem_id: 1068 Time: 0 Memory: 1620
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- #include <ctype.h>
- #include <time.h>
- typedef long long LL;
- typedef unsigned long long ULL;
- LL fac[1010] = {0};
- #define MOD 10000007
- void init(){
- int i = 1;
- fac[1] = 1;fac[2] = 2;
- for(i = 3;i <= 1000;i += 2){
- fac[i] = (i * fac[i - 2]) % MOD;
- }
- for(i = 4;i <= 1000;i += 2){
- fac[i] = (i * fac[i - 2]) % MOD;
- }
- }
- int main(){
- #ifdef _DEBUG
- FILE *fp = freopen("input.txt","r",stdin);
- if(!fp){
- fp = fopen("input.txt","w");
- fclose(fp);
- return 1;
- }
- #endif
- init();
- int n,i;
- scanf("%d",&n);
- while(n--){
- scanf("%d",&i);
- printf("%lld\n",fac[i]);
- }
- #ifdef _DEBUG
- fp = freopen("CON","r",stdin);
- system("pause");
- #endif // _DEBUG
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement