HDU 4475 Downward paths

#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>

using namespace std;
#define LL long long
const int N =  1000009;
const LL MOD = 1000003;
int re[N];
void init()
{
    LL k = 1;
    for(int i=1;i<N;i++)
    {
        k = (k*i*2)%MOD;
        re[i] =(int)k;
    }
}
int main()
{
    //freopen("in.txt","r",stdin);
    init();
    int cas;
    scanf("%d",&cas);
    while(cas--)
    {
        LL t;
        cin>>t;
        if(t>=MOD) cout<<0<<endl;
        else
        cout<<re[t]<<endl;
    }
    return 0;
}

你可能感兴趣的:(HDU 4475 Downward paths)