結果

問題 No.237 作図可能性
ユーザー mine691mine691
提出日時 2019-04-13 18:44:45
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,063 bytes
コンパイル時間 1,691 ms
コンパイル使用メモリ 171,184 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-13 14:31:12
合計ジャッジ時間 2,736 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,352 KB
testcase_24 AC 1 ms
4,352 KB
testcase_25 AC 2 ms
4,356 KB
testcase_26 AC 1 ms
4,352 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
void print(vector<T> vec)
{
    int n = vec.size();
    for (int i = 0; i < n; i++)
    {
        cout << vec[i] << (i == n - 1 ? "\n" : " ");
    }
}

int main()
{
    vector<ll> f_list, ans;
    ll a, f[] = {3, 5, 17, 257, 65537}, p = 1;
    cin >> a;
    for (int i = 0; i < (1 << 5); i++)
    {
        p = 1;
        for (int j = 0; j < 5 && p < inf; j++)
        {
            if (i & (1 << j))
                p *= f[j];
            if (j == 4 && p < inf)
                f_list.push_back(p);
        }
    }
    //print(f_list);
    ll pow2 = 1;
    for (int i = 0; i < 32; i++, pow2 *= 2)
    {
        for (auto can : f_list)
        {
            ans.push_back(pow2 * can);
        }
    }
    sort(ans.begin(), ans.end());
    int q = 0;
    for (int i = 0; i < ans.size(); i++)
    {
        if (ans[i] <= a && ans[i] >= 3)
            q++;
    }
    cout << q << endl;
}
0