fork download
  1. #include <bits/stdc++.h>
  2. typedef long long ll;
  3. using namespace std;
  4. using namespace chrono;
  5. using ull = unsigned long long;
  6. auto start = high_resolution_clock::now();
  7. void Code_By_Mohamed_Khaled() {
  8. ios_base::sync_with_stdio(false);
  9. cin.tie(nullptr);
  10. cout.tie(nullptr);
  11. #ifndef ONLINE_JUDGE
  12. freopen("input.txt", "r", stdin);
  13. freopen("output.txt", "w", stdout);
  14. #endif
  15. }
  16. void Time() {
  17. #ifndef ONLINE_JUDGE
  18. cout<<"\n";
  19. auto end = high_resolution_clock::now();
  20. auto duration = duration_cast<microseconds>(end - start);
  21. cout << "Time taken: " << duration.count() << " microseconds" << endl;
  22. #endif
  23. }
  24. const ll mod = 1e7+ 7;
  25. ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
  26. ll mul(ll a, ll b) { return ((a%mod)*(b%mod)) % mod; }
  27. ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
  28. ll N=1e6;
  29. vector<bool>is_prime(N+1,false);
  30. vector<int>primes;
  31. void Linear_Sieve() {
  32. for (ll i=2;i<=N;i++) {
  33. if (!is_prime[i])primes.push_back(i);
  34. for (ll j=0;j<primes.size() and primes[j]*i<=N;j++) {
  35. is_prime[primes[j]*i]=true;
  36. if (i%primes[j]==0)break;
  37. }
  38. }
  39. }
  40. ll inv=(mod+1)/2;
  41. int main() {
  42. Code_By_Mohamed_Khaled();
  43. Linear_Sieve();
  44. ll t;
  45. while (cin>>t and t>0) {
  46. ll n;n=t;ll ans=1;
  47. for (auto it:primes) {
  48. if (n<it)break;
  49. ll cnt=0;ll temp=n;
  50. while (temp>0) {
  51. cnt+=temp/it;
  52. temp=temp/it;
  53. }
  54. ans=mul(ans,mul(cnt+1,cnt+2))*inv%mod;
  55. }
  56. cout<<ans<<"\n";
  57. }
  58. Time();
  59. return 0;
  60. }
Success #stdin #stdout 0.03s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty