結果

問題 No.237 作図可能性
ユーザー kyuridenamidakyuridenamida
提出日時 2016-08-25 15:52:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,510 bytes
コンパイル時間 747 ms
コンパイル使用メモリ 101,048 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 15:17:20
合計ジャッジ時間 1,594 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <unordered_set>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <fstream>
#include <sstream>
#include <complex>
#include <bitset>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rev(i,n) for(int i=(n)-1;(i)>=0;(i)--)
#define all(a) (a).begin(),(a).end()
#define pb(a) push_back(a)
#define bitcount(b) __builtin_popcount(b)
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
template<typename T> void operator>>(vector<T>& a, int b) {while(b--)if(!a.empty())a.pop_back();}
bool isprime(int n){ if(n<2)return false;  for(int i=2;i*i<=n;i++)if(n%i==0)return false;  return true;} 

long long pw(long long a,long long b){
	return b ? pw(a*a,b/2) * (b&1?a:1) : 1;
}


int main(){
	vector<long long> p;
	int n = 0;
	while( pw(2,pw(2,n)) + 1 <= 1e9 ){
		long long x = pw(2,pw(2,n)) + 1;
		if( isprime(x) ) p.push_back(x);
		n++;
	}
	long long l;
	cin >> l;
	int ans = 0;
	for(int i = 0 ; i < (1<<p.size()) ; i++){
		long long v = 1;
		for(int j = 0 ; j < p.size() ; j++)
			if( i >> j & 1 ) v *= p[j];
		while(v<=l ){
			if( v >= 3 ) ans++;
			v *= 2;
		}
	}
	cout << ans << endl;

}
0