結果

問題 No.237 作図可能性
ユーザー face4
提出日時 2018-05-21 22:54:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 64,384 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 15:38:20
合計ジャッジ時間 1,611 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

typedef long long ll;

int main(){
    ll fermat[5] = {3, 5, 17, 257, 65537};
    int a, cnt = 0;
    cin >> a;

    for(int i = 0; i < 30; i++){
        for(int j = 0; j < 32; j++){
            ll candidate = 1ll<<i;
            if(j&1) candidate *= 3;
            if(j&2) candidate *= 5;
            if(j&4) candidate *= 17;
            if(j&8) candidate *= 257;
            if(j&16) candidate *= 65537;

            if(candidate >= 3 && candidate <= a)    cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}
0