fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios_base::sync_with_stdio(false);
  6. cin.tie(NULL);
  7. long long N;
  8. cin>>N;
  9. if(N>1000000006){
  10. cout<<0;
  11. return 0;
  12. }
  13. long long d=1;
  14. for(int i=1; i<N+1; i++){
  15. long long r=i%1000000007;
  16. d=d*r;
  17. d=d%1000000007;
  18.  
  19. }
  20. cout<<d;
  21. return 0;
  22. }
Success #stdin #stdout 0.04s 5316KB
stdin
10000000
stdout
682498929