結果
問題 | No.106 素数が嫌い!2 |
ユーザー |
![]() |
提出日時 | 2015-06-13 17:31:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 499 ms |
コンパイル使用メモリ | 75,864 KB |
実行使用メモリ | 11,048 KB |
最終ジャッジ日時 | 2024-07-06 19:49:30 |
合計ジャッジ時間 | 1,378 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cmath> #include <iomanip> #include <map> using namespace std; typedef long long LL; int main(){ int n, k; cin >> n >> k; vector<int> cnt(n+1); for(int i = 2; i <= n; i++){ if(cnt[i] == 0){ for(int j = i; j <= n; j+=i){ cnt[j]++; } } } int ans = 0; for(int i = 2; i <= n; i++){ if(cnt[i] >= k) ans++; } cout << ans << endl; return 0; }