Submission #1534995
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Globalization; using System.Diagnostics; using static System.Console; using Pair = System.Collections.Generic.KeyValuePair<int, int>; //using System.Numerics; class Program { static void Main() { //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } Scanner cin = new Scanner(); Random rnd = new Random(); Stopwatch sw = new Stopwatch(); readonly int[] dd = { 0, 1, 0, -1, 0 }; readonly int mod = 1000000007; readonly string alfa = "abcdefghijklmnopqrstuvwxyz"; readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int N; void solve() { N = cin.nextint; var P = new List<int>(); eratos(P, 1000); var A = new long[1001];//素因数分解 for (int i = 1; i <= N; i++) { int j = i; foreach (var item in P) { while (j % item == 0) { A[item]++; j /= item; } } } long ans = 1; foreach (var item in A) { ans *= (item + 1); ans %= mod; } WriteLine(ans); } //2~nまでの素数のリスト(n>=2) void eratos(List<int> P, int n) { var a = new bool[n + 1]; a[0] = a[1] = true; int i; for (i = 2; i * i <= n; i++) { if (!a[i]) { P.Add(i); int j = i << 1; while (j <= n) { a[j] = true; j = j + i; } } } for (; i <= n; i++) if (!a[i]) P.Add(i); } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan { get { return ReadLine().Split(); } } public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } } public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } } public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } } public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint { get { return int.Parse(next); } } public long nextlong { get { return long.Parse(next); } } public double nextdouble { get { return double.Parse(next); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Factors of Factorial |
User | claw88 |
Language | C# (Mono 4.6.2.0) |
Score | 300 |
Code Size | 2896 Byte |
Status | AC |
Exec Time | 24 ms |
Memory | 11328 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 | 22 ms | 9280 KB |
sample_02.txt | AC | 23 ms | 11328 KB |
sample_03.txt | AC | 24 ms | 11328 KB |
subtask_1_certain_01.txt | AC | 23 ms | 11200 KB |
subtask_1_certain_02.txt | AC | 23 ms | 11200 KB |
subtask_1_certain_03.txt | AC | 24 ms | 11328 KB |
subtask_1_certain_04.txt | AC | 24 ms | 11328 KB |
subtask_1_rand_01.txt | AC | 24 ms | 11328 KB |
subtask_1_rand_02.txt | AC | 24 ms | 11328 KB |
subtask_1_rand_03.txt | AC | 23 ms | 9280 KB |