Submission #11443502
Source Code Expand
# include <bits/stdc++.h> # define ll int64_t # define rep(i,n) for(ll i=0;i<n;i++) # define rrep(i,n) for(ll i=1;i<=n;i++) # define ALL(x) (x).begin(), (x).end() # define SZ(x) ((int)(x).size()) # define pb push_back # define mod 1000000007 using namespace std; bool compare_by_b(pair<string,ll> a,pair<string,ll> b){ if(a.second != b.second) return a.second<b.second; else return a.first<b.first; } bool my_compare(pair<string,ll> a,pair<string,ll> b){ if(a.first != b.first) return a.first<b.first; if(a.second != b.second) return a.second>b.second; else return true; } ll factorial(ll n){ ll x=1; rrep(i,n) x*=i; return x; } ll gcd(ll a,ll b) { if (a%b == 0) return(b); else return(gcd(b,a%b)); } ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } void factoring(ll n, map<ll, ll>& mp) { for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { mp[i]++; n /= i; } } if (n != 1) mp[n]++; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n,sum=1; cin>>n; map<ll,ll> mp; rrep(j,n) factoring(j,mp); for(auto p:mp){ sum*=(p.second+1); sum%=mod; } cout<<sum%mod<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Factors of Factorial |
User | fidia |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1312 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_certain_01.txt, subtask_1_certain_02.txt, subtask_1_certain_03.txt, subtask_1_certain_04.txt, subtask_1_rand_01.txt, subtask_1_rand_02.txt, subtask_1_rand_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
subtask_1_certain_01.txt | AC | 1 ms | 256 KB |
subtask_1_certain_02.txt | AC | 1 ms | 256 KB |
subtask_1_certain_03.txt | AC | 1 ms | 256 KB |
subtask_1_certain_04.txt | AC | 1 ms | 256 KB |
subtask_1_rand_01.txt | AC | 1 ms | 256 KB |
subtask_1_rand_02.txt | AC | 1 ms | 256 KB |
subtask_1_rand_03.txt | AC | 1 ms | 256 KB |