結果
問題 | No.3035 2018 |
ユーザー | tanzaku |
提出日時 | 2018-04-02 00:43:47 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 513 ms / 2,000 ms |
コード長 | 2,375 bytes |
コンパイル時間 | 2,362 ms |
コンパイル使用メモリ | 78,888 KB |
実行使用メモリ | 63,140 KB |
最終ジャッジ日時 | 2024-06-26 06:23:57 |
合計ジャッジ時間 | 8,134 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 492 ms
62,844 KB |
testcase_01 | AC | 507 ms
63,140 KB |
testcase_02 | AC | 502 ms
62,908 KB |
testcase_03 | AC | 513 ms
62,864 KB |
testcase_04 | AC | 504 ms
62,920 KB |
testcase_05 | AC | 492 ms
62,832 KB |
testcase_06 | AC | 485 ms
63,060 KB |
testcase_07 | AC | 489 ms
62,628 KB |
testcase_08 | AC | 463 ms
62,880 KB |
testcase_09 | AC | 488 ms
62,832 KB |
ソースコード
import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Map.Entry; import java.util.Scanner; import java.util.TreeMap; public class Main { static int[] primeGap = new int[] {16, 28, 52, 84}; static int[] factorCount = new int[] {24,24,4,16,80,12,32,16,24,12,96,8,32,4,96,2,48,16,4,80,24,16,16,8,48,32,8,2,48,8,16,16,12,4,48,8,60,24,8,8,48,4,8,16,16,4,64,8,12,32,8,2,160,4,96,12,12,4,64,6,8,16,16,24,72,4,8,16,10,16,32,16,12,16,8,4,64,32,16,32,48,8,12,2,192,4,8,8,48,16,4,24,16,8,32,6,24,32,16,4}; void solveTestcase(final Scanner in, final PrintWriter out) { int max = 5111443; int[] cnt = new int[max + 1]; Arrays.fill(cnt, 1); for (int i = 2; i < cnt.length; i++) { if (cnt[i] == 1) { for (int j = i; j < cnt.length; j += i) { int x = 1; for (int k = j; k % i == 0; k /= i) x++; cnt[j] *= x; } } } // dump(Arrays.copyOf(cnt, 10)); int n = in.nextInt(); for (int i = 1, j = 0; ; i++) { if (cnt[i] == 4) { // dump(++j, i); if (++j == n) { out.println(i); return; } } } } void solve() { try (final PrintWriter out = new PrintWriter(System.out)) { try (final Scanner in = new Scanner(System.in)) { // int t = in.nextInt(); int t = 1; while (t-- > 0) { solveTestcase(in, out); } } } } public static void main(String[] args) { new Main().solve(); } // [l,r] boolean[] segmentSieve(long l, long r) { boolean[] res = new boolean[(int)(r-l+1)]; boolean[] small = new boolean[(int)Math.sqrt(r)+1]; Arrays.fill(res, true); Arrays.fill(small, true); if(l <= 1) res[0] = false; if(l <= 0) res[1] = false; for(int i = 2; (long)i*i <= r; i++) { if(small[i]) { if((long)i*i < small.length) { for(int j = i*i; j < small.length; j += i) { small[j] = false; } } { long v = (l + i - 1) / i * i; int j = (int)((v == i ? v + i : v) - l); for(; j < res.length; j += i) { res[j] = false; } } } } return res; } private static int factorCount(long t) { int res = 1; for(int i = 2; (long)i*i <= t && res <= 4; i++) { int cnt = 1; while(t % i == 0) { t /= i; cnt++; } res *= cnt; } if(t != 1) { res *= 2; } return res; } static void dump(Object...objects) { System.err.println(Arrays.deepToString(objects)); } }