結果

問題 No.106 素数が嫌い!2
ユーザー dnishdnish
提出日時 2017-07-09 01:40:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 1,684 ms
コンパイル使用メモリ 162,168 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-16 06:45:32
合計ジャッジ時間 2,579 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,424 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 13 ms
7,424 KB
testcase_05 AC 31 ms
11,392 KB
testcase_06 AC 30 ms
11,392 KB
testcase_07 AC 31 ms
11,264 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 30 ms
11,392 KB
testcase_11 AC 11 ms
7,040 KB
testcase_12 AC 29 ms
11,136 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int) N;i++)
#define p(s) cout<<(s)<<endl
using namespace std;

int cnt[2000100];
int main(){
	int N,K;
	cin>>N>>K;
	for(int i=2;i<=N;i++){
		if(cnt[i]==0) for(int j=i;j<=N;j+=i) cnt[j]++;
	}
	int ans=0;
	REP(i,2,N+1){
		ans+=cnt[i]>=K;
	}
	p(ans);
	return 0;
}
0