結果

問題 No.106 素数が嫌い!2
ユーザー troro_kelptroro_kelp
提出日時 2019-04-09 12:52:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,008 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 93,872 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 15:54:18
合計ジャッジ時間 15,225 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,094 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2,092 ms
4,380 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 110 ms
4,376 KB
testcase_09 AC 122 ms
4,380 KB
testcase_10 TLE -
testcase_11 AC 1,736 ms
4,380 KB
testcase_12 TLE -
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(5);

    ll N, K;
    cin >> N >> K;

    int ans = 0;
    for (int i = 2; i <= N; ++i)
    {
        int cnt = 0;
        int n = i;
        for (int j = 2; j * j <= i; ++j)
        {
            if (n % j == 0)
            {
                cnt++;
                while (n % j == 0)
                {
                    n /= j;
                }
            }
        }
        if (n != 1)
            cnt++;
        if (cnt >= K)
            ans++;
    }
    cout << ans << endl;
    return 0;
}
0