結果

問題 No.237 作図可能性
ユーザー bal4ubal4u
提出日時 2019-05-11 19:55:31
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 28,652 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 18:14:01
合計ジャッジ時間 1,671 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// yukicoder: No.237 作図可能性
// 2019.5.11

#include <stdio.h>

#define MAX 1000000000
// #define FLEN 5
// int fermat[] = { 3, 5, 17, 257, 65537 };
int fn[] = { 1,3,5,15,17,51,85,255,257,771,1285,3855,4369,
  13107,21845,65535,65537,196611,327685,983055,1114129,3342387,
  5570645,16711935,16843009,50529027,84215045,252645135,
286331153,858993459, MAX+1 };
#define PLEN 31
int p2[35];

int bsch(int x) {
	int m, l = 0, r = PLEN;
    while (l < r) {
        m = (l+r) >> 1;
        if (p2[m] <= x) l = m + 1; else r = m;
    }
	if (l == 0) return 1;
	return l;
}

int main()
{
	int i, A, ans;
	
	for (i = 0; i < PLEN; i++) p2[i] = 1<<i;
	scanf("%d", &A);
	ans = 0; for (i = 0; fn[i] <= A; i++) ans += bsch(A/fn[i]);
	printf("%d\n", ans-2);
	return 0;
}
0