Submission #1067327
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String args[]) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long answer =1; int modulo = 1000000007; // HashMap<Integer,Integer> map = new HashMap<>(); for(int i=2;i<=n;i++){ if(isPrime(i)){ answer *= (calFactors(n,i)+1); if(answer>modulo){ answer = answer%modulo; } } } System.out.print(answer); sc.close(); } private static boolean isPrime(int x){ for(int i=2;i<x;i++){ if(x%i==0) return false; } return true; } private static int calFactors(int n,int base){ int ret = 0; int tmp = base; while(tmp<=n) { ret += Math.floor( n / tmp); tmp *=base; } return ret; } }
Submission Info
Submission Time | |
---|---|
Task | C - Factors of Factorial |
User | cxr1242 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 1018 Byte |
Status | AC |
Exec Time | 139 ms |
Memory | 9812 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 | 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 | 129 ms | 9808 KB |
sample_02.txt | AC | 127 ms | 9680 KB |
sample_03.txt | AC | 131 ms | 9796 KB |
subtask_1_certain_01.txt | AC | 127 ms | 9800 KB |
subtask_1_certain_02.txt | AC | 127 ms | 9812 KB |
subtask_1_certain_03.txt | AC | 130 ms | 9792 KB |
subtask_1_certain_04.txt | AC | 139 ms | 9668 KB |
subtask_1_rand_01.txt | AC | 129 ms | 9808 KB |
subtask_1_rand_02.txt | AC | 129 ms | 9676 KB |
subtask_1_rand_03.txt | AC | 129 ms | 9680 KB |