結果
| 問題 |
No.237 作図可能性
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-05-11 19:55:31 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 761 bytes |
| コンパイル時間 | 176 ms |
| コンパイル使用メモリ | 29,184 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-02 01:16:52 |
| 合計ジャッジ時間 | 1,245 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
// 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;
}
bal4u