結果
問題 | No.414 衝動 |
ユーザー | denderaKawazu |
提出日時 | 2018-02-09 14:15:19 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 746 ms / 1,000 ms |
コード長 | 1,466 bytes |
コンパイル時間 | 1,881 ms |
コンパイル使用メモリ | 80,232 KB |
実行使用メモリ | 140,076 KB |
最終ジャッジ日時 | 2024-04-27 08:33:30 |
合計ジャッジ時間 | 8,440 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 551 ms
109,124 KB |
testcase_01 | AC | 121 ms
54,544 KB |
testcase_02 | AC | 143 ms
54,968 KB |
testcase_03 | AC | 746 ms
137,896 KB |
testcase_04 | AC | 290 ms
83,112 KB |
testcase_05 | AC | 745 ms
137,932 KB |
testcase_06 | AC | 725 ms
140,076 KB |
testcase_07 | AC | 123 ms
54,672 KB |
testcase_08 | AC | 491 ms
102,332 KB |
testcase_09 | AC | 745 ms
137,880 KB |
testcase_10 | AC | 140 ms
54,740 KB |
testcase_11 | AC | 200 ms
60,572 KB |
testcase_12 | AC | 168 ms
57,696 KB |
ソースコード
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.solve(1, in, out); out.close(); } static class Task { private static HashSet<Integer> primeNumbers = new HashSet<>(); private static long getMinDivisor(long n) { primeNumbers.clear(); int max = (int) Math.sqrt(n) + 1; for (int i = 2; i < max; i++) { if (!primeNumbers.contains(i)) { int cn = i; while (cn < max) { primeNumbers.add(cn); cn += i; } if (n % (long) i == 0) { return i; } } } return n; } public void solve(int testNumber, Scanner in, PrintWriter out) { long n = in.nextLong(); long d = getMinDivisor(n); out.println(d + " " + n / d); } } }