Submission #1350032
Source Code Expand
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define INF 1e9+7
#define pf2 pop_front
#define pb2 pop_back
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz size
#define eps 1e-7
#define fod find_by_order
#define fastio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ofk order_of_key
#define val(x) cout << "Value dari "<< #x << " adalah " << x << "\n"
#define tr tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void readf(string x){
freopen((x+".in").c_str(),"r",stdin);
freopen((x+".out").c_str(),"w",stdout);
}
void pr(string x){
freopen((x+".in").c_str(),"w",stdout);
}
int read()
{
bool min = 0;
int result = 0;
char ch;
ch = getchar();
while(1)
{
if(ch == '-') break;
if(ch >='0' && ch <= '9') break;
ch = getchar();
}
if(ch == '-') min = 1;else result = ch-'0';
while(1)
{
ch =getchar();
if(ch< '0' || ch>'9') break;
result = result * 10 + (ch-'0');
}
if(min) return -result;
return result;
}
//Reynaldo's Template
#define MOD 1000000007
int main(){
ll N;
cin >> N;
ll x[N+5],ans[N+5];
memset(ans,0,sizeof ans);
for(int i=1;i<=N;i++){
x[i] = i;
}
for(int i=2;i<=N;i++){
for(int j=1;j<=N;j++){
while(x[j] != 1 && x[j] % i == 0){
ans[i]++;
x[j] /= i;
}
}
}
ll hit = 1;
for(int i=1;i<=N;i++){
hit = hit * (ans[i] + 1);
hit %= MOD;
}
cout << hit << "\n";
//ll ans = 0;
}
Submission Info
Submission Time |
|
Task |
C - Factors of Factorial |
User |
rwhendry |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1676 Byte |
Status |
AC |
Exec Time |
4 ms |
Memory |
256 KB |
Compile Error
./Main.cpp: In function ‘void readf(std::string)’:
./Main.cpp:26:38: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen((x+".in").c_str(),"r",stdin);
^
./Main.cpp:27:40: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen((x+".out").c_str(),"w",stdout);
^
./Main.cpp: In function ‘void pr(std::string)’:
./Main.cpp:31:39: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen((x+".in").c_str(),"w",stdout);
^
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 |
4 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 |
4 ms |
256 KB |
subtask_1_certain_04.txt |
AC |
4 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 |