Submission #2216341
Source Code Expand
// ------------------------------------ // Date:2018/ 3/17 // Problem:ARC 067 FactorsOfFactorial c.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i,a) for (auto& i : a) #define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i) #define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(a) (a).begin(),(a).end() #define debug(x) cerr << #x << ":" << x << endl typedef long long ll; void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail) { cin >> head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) static const int MOD = 1e9 + 7; static const int MAX_N = 1010; bool prime[MAX_N]; void init() { FOR(i, 2, MAX_N) { for (int j = 0; i * (j + 2) < MAX_N; ++j) { prime[i * (j + 2)] = true; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); memset(prime, false, sizeof(prime)); CIN(N); init(); ll ans = 1ll; FOR(i, 2, MAX_N) { if (prime[i]) continue; ll cnt = 0; FOR(j, 2, N + 1) { ll tmp = j; while(tmp % i == 0) { cnt++; tmp /= i; } } ans = (ans % MOD) * ((cnt + 1) % MOD); ans %= MOD; // debug(i); // debug(ans); } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Factors of Factorial |
User | task4233 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1514 Byte |
Status | AC |
Exec Time | 3 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 | 3 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 | 3 ms | 256 KB |
subtask_1_certain_04.txt | AC | 3 ms | 256 KB |
subtask_1_rand_01.txt | AC | 2 ms | 256 KB |
subtask_1_rand_02.txt | AC | 2 ms | 256 KB |
subtask_1_rand_03.txt | AC | 2 ms | 256 KB |