// yukicoder: No.237 作図可能性 // 2019.5.11 #include #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<