結果
問題 | No.106 素数が嫌い!2 |
ユーザー |
![]() |
提出日時 | 2017-07-09 01:40:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 5,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 1,463 ms |
コンパイル使用メモリ | 167,308 KB |
実行使用メモリ | 11,160 KB |
最終ジャッジ日時 | 2024-10-06 20:26:44 |
合計ジャッジ時間 | 2,266 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#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; }