fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const unsigned int M = 1000000007;
  4. int main()
  5. {
  6. int num,t;
  7. unsigned long long f = 1;
  8. cin>>t;
  9. while(t--)
  10. {
  11. cin>>num;
  12. if (num==0)
  13. cout<<"1"<<"\n";
  14. else
  15. {
  16. for(int i=1;i<=num;i++){
  17. f = (f*i);
  18. f=f%M;
  19. }
  20. }
  21. f=f%M;
  22. cout<<f<<"\n";
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5544KB
stdin
3
5
20
50
stdout
120
559127441
313247661