結果

問題 No.237 作図可能性
ユーザー imulan
提出日時 2016-02-06 19:13:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 724 bytes
コンパイル時間 1,389 ms
コンパイル使用メモリ 157,928 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 20:51:51
合計ジャッジ時間 2,208 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

int main(int argc, char const *argv[]) {
  int i,j;

  ll a;
  cin >>a;

  //フェルマー素数
  ll f[5]={3,5,17,257,65537};

  ll pw[31]={0};
  pw[0]=1;
  rep(i,30) pw[i+1]=pw[i]*2;

  ll ans=0;
  for(i=(1<<5)-1; i>=0; --i){
    //かけるべきフェルマー素数をビットで
    ll t=1;
    rep(j,5) if((i>>j)&1) t*=f[j];

    //かける2の累乗数
    for(j=0; t*pw[j]<=a; ++j);

    ans+=j;
  }

  std::cout << ans-2 << std::endl;
  return 0;
}
0