Submission #3000345
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define fst first #define snd second typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; #define pb push_back #define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++) #ifndef ONLINE_JUDGE #define debug(args...) fprintf(stderr,args) #else #define debug(args...) #endif //ONLINE_JUDGE template<typename T> inline T abs(T t) { return t < 0? -t : t; } const ll modn = 1000000007; inline ll mod(ll x) { return x % modn; } const int MAXN = 1023; int n, m, k; int s[MAXN], mrk[MAXN]; ll cnt[MAXN]; vector<ll> p; int main (){ for(ll a=2;a<MAXN;a++){ if(mrk[a])continue; p.pb(a); for(ll b=a;a*b<MAXN;b++) mrk[a*b] = 1; } scanf("%d", &n); for(int a=2;a<=n;a++){ int val = a; for(int ip = 0;ip < p.size();ip++){ ll pri = p[ip]; if(pri > val) break; while(val%pri == 0 && val != 0){ val/=pri; cnt[ip]++; } } } ll res = 1; for(int a=0;a<p.size();a++){ res = mod(res *( cnt[a] + 1) ); } printf("%lld\n", res); }
Submission Info
Submission Time | |
---|---|
Task | C - Factors of Factorial |
User | vjudge5 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1052 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:35:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^
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 | 2 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 | 2 ms | 256 KB |
subtask_1_certain_04.txt | AC | 2 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 |