結果
問題 |
No.106 素数が嫌い!2
|
ユーザー |
![]() |
提出日時 | 2018-01-15 23:14:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 24 ms / 5,000 ms |
コード長 | 704 bytes |
コンパイル時間 | 880 ms |
コンパイル使用メモリ | 81,948 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-24 03:45:28 |
合計ジャッジ時間 | 1,445 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { int N,K; cin >> N >> K; vector<int> P(N+1,0); for ( int i = 2; i <= N; i++ ) { if ( P[i] == 0 ) { for ( int j = i; j <= N; j += i ) { P[j]++; } } } int ans = 0; for ( int i = 2; i <= N; i++ ) { if ( P[i] >= K ) { ans++; } } cout << ans << endl; return 0; }