Submission #1441812
Source Code Expand
import java.util.*; import java.lang.*; import java.io.*; import java.math.BigDecimal; public class Main{ static long mod = (long)1e9 + 7; public static void main (String[] args) throws java.lang.Exception { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt() ; HashMap<Integer, Integer> hm = new HashMap<>(); for (int i = 1; i <= n; i++) hm.put(i, 0); for (int i = 2; i <= n; i++) { int num = i; for (int j = 2; j <= Math.sqrt(i); j++) { int temp = 0; while (num % j == 0) { num /= j; temp++; } hm.put(j, hm.get(j) + temp); } if (num > 1) { hm.put(num, hm.get(num) + 1); } } long ans = 1; for (int x : hm.keySet()) { ans = (ans * (hm.get(x) + 1)) % mod; } w.println(ans); w.close(); } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) throw new UnknownError(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new UnknownError(); } if (numChars <= 0) return -1; } return buf[curChar++]; } public int peek() { if (numChars == -1) return -1; if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { return -1; } if (numChars <= 0) return -1; } return buf[curChar]; } public void skip(int x) { while (x-- > 0) read(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public String nextString() { return next(); } public String next() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuffer res = new StringBuffer(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { StringBuffer buf = new StringBuffer(); int c = read(); while (c != '\n' && c != -1) { if (c != '\r') buf.appendCodePoint(c); c = read(); } return buf.toString(); } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; while (!isSpaceChar(c) && c != '.') { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } if (c == '.') { c = read(); double m = 1; while (!isSpaceChar(c)) { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); m /= 10; res += (c - '0') * m; c = read(); } } return res * sgn; } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public long[] nextLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } public boolean hasNext() { int value; while (isSpaceChar(value = peek()) && value != -1) read(); return value != -1; } private boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } } }
Submission Info
Submission Time | |
---|---|
Task | C - Factors of Factorial |
User | ashubeckham |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 5270 Byte |
Status | AC |
Exec Time | 97 ms |
Memory | 21332 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 | 70 ms | 18900 KB |
sample_02.txt | AC | 69 ms | 19028 KB |
sample_03.txt | AC | 96 ms | 21204 KB |
subtask_1_certain_01.txt | AC | 69 ms | 19284 KB |
subtask_1_certain_02.txt | AC | 69 ms | 21332 KB |
subtask_1_certain_03.txt | AC | 94 ms | 19540 KB |
subtask_1_certain_04.txt | AC | 97 ms | 19540 KB |
subtask_1_rand_01.txt | AC | 75 ms | 19284 KB |
subtask_1_rand_02.txt | AC | 88 ms | 20052 KB |
subtask_1_rand_03.txt | AC | 87 ms | 18132 KB |