結果
問題 |
No.106 素数が嫌い!2
|
ユーザー |
![]() |
提出日時 | 2018-05-23 00:52:57 |
言語 | Perl (5.40.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 42 ms |
コンパイル使用メモリ | 5,760 KB |
実行使用メモリ | 280,704 KB |
最終ジャッジ日時 | 2024-06-28 15:58:11 |
合計ジャッジ時間 | 20,732 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 TLE * 4 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/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";