結果
| 問題 |
No.106 素数が嫌い!2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-20 19:34:19 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 588 bytes |
| コンパイル時間 | 3,779 ms |
| コンパイル使用メモリ | 74,980 KB |
| 実行使用メモリ | 51,600 KB |
| 最終ジャッジ日時 | 2024-06-12 02:33:17 |
| 合計ジャッジ時間 | 15,418 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 12 |
ソースコード
import java.util.Scanner;
public class Yukicoder106 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int res = 0;
for (int i = 2; i <= n; i++) {
if (divDistinctNum(i) == k) res++;
}
System.out.println(res);
}
public static long divDistinctNum(long num) {
long res = 1, buf = 0, dist = 0;
for (long i = 2; i <= num; i++) {
if (num % i == 0) {
dist++;
buf = 0;
do {
num /= i;
buf++;
} while (num % i == 0);
res *= (buf + 1);
}
}
return dist;
}
}