fork download
  1. #include <iostream>
  2. #include <boost/multiprecision/cpp_int.hpp>
  3.  
  4. using namespace std;
  5. using namespace boost::multiprecision;
  6.  
  7. int main()
  8. {
  9. const cpp_int M=1000000007;
  10. cpp_int lcm(cpp_int,cpp_int),rlcm(cpp_int,cpp_int);
  11. cpp_int n;
  12. cin>>n;
  13. cout<<rlcm(1,n)%M;
  14. return 0;
  15. }
  16.  
  17. cpp_int lcm(cpp_int a,cpp_int b)
  18. { cpp_int c,a1,b1;
  19. a1=a;
  20. b1=b;
  21. while(b!=0)
  22. { c=a;
  23. a=b;
  24. b=c%b;
  25. }
  26. return a1*(b1/a);
  27. }
  28.  
  29. cpp_int rlcm(cpp_int f,cpp_int l)
  30. {
  31. cpp_int lcm(cpp_int,cpp_int);
  32. cpp_int c=f+1;
  33. for(;c<=l;c++)
  34. {
  35. f=lcm(f,c);
  36. }
  37.  
  38. return f;
  39. }
Success #stdin #stdout 0s 3476KB
stdin
1000
stdout
849686073