結果

問題 No.106 素数が嫌い!2
ユーザー motimoti
提出日時 2018-05-23 00:52:57
言語 Perl
(5.38.2)
結果
TLE  
実行時間 -
コード長 331 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 115,536 KB
最終ジャッジ日時 2023-09-11 01:27:09
合計ジャッジ時間 15,632 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,920 ms
115,536 KB
testcase_01 AC 5 ms
4,904 KB
testcase_02 AC 5 ms
4,940 KB
testcase_03 AC 5 ms
5,084 KB
testcase_04 AC 3,015 ms
115,408 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use warnings;

my ($n, $k) = split / /, <>; chomp $k;

if ($k >= 21) {
  print "0\n";
  exit;
}

my $ans = 0;
my %h;
for (my $i = 2; $i <= $n; $i++) {
  if (!exists$h{$i}) {
    for (my $j = $i; $j <= $n; $j+=$i) {
      $h{$j}++;
    }
  }
  if ($h{$i} >= $k) {
    $ans++;
  }
}

print "$ans\n";
0