fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define l long long
  4. l u[100000];
  5. l MOD=1000000007;
  6. int main(){
  7. int t,num;
  8. cin>>t;
  9. u[0]=1;
  10. u[1]=1;
  11. for(int i=2;i<=100000;i++)
  12. u[i]=(u[i-1]%MOD*i%MOD)%MOD;
  13. while(t--)
  14. {
  15. cin>>num;
  16. cout<<u[num]%1000000007<<endl;
  17. }
  18.  
  19.  
  20. // your code goes here
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5528KB
stdin
4
0
1
2
5
stdout
1
1
2
120