正文
增加 8 行删除 8 行
8 行未改动910111213141516171819202122232425262728293031323334353637383 行未改动42434445464748495051525 行未改动8 行未改动```cppint dp(int u, bool sb, bool bs) {if (!u) return 1;int& res = f[u][sb][bs];if (~res) return res;res = 0;int t1 = sb ? a[u] : 1;int t2 = bs ? b[u] : 1;for (int i = 0; i <= t1; ++ i )for (int j = 0; j <= t2; ++ j )if (!i || !j) res += dp(u - 1, sb && (i == t1), bs && (j == t2));return res;}int calc(int x, int y) {if (x < 0 || y < 0) return 0;memset(f, -1, sizeof f);memset(a, 0, sizeof a);memset(b, 0, sizeof b);int l = 0;while (x) {a[ ++ l] = x & 1;x >>= 1;3 行未改动b[ ++ l] = y & 1;y >>= 1;}len = max(len, l);int res = dp(len, 1, 1);return dp(len, 1, 1);}void Luogu_UID_748509() {5 行未改动8 行未改动910111213141516171819202122232425262728293031323334353637383 行未改动42434445464748495051525 行未改动8 行未改动```cppint dp(int u, bool sb, bool bs) {if (!u) return 1;int& res = f[u][sb][bs];if (~res) return res;res = 0;int t1 = sb ? a[u] : 1;int t2 = bs ? b[u] : 1;for (int i = 0; i <= t1; ++ i )for (int j = 0; j <= t2; ++ j )if (!i || !j) res += dp(u - 1, sb && (i == t1), bs && (j == t2));return res;}int calc(int x, int y) {if (x < 0 || y < 0) return 0;memset(f, -1, sizeof f);memset(a, 0, sizeof a);memset(b, 0, sizeof b);int l = 0;while (x) {a[ ++ l] = x & 1;x >>= 1;3 行未改动b[ ++ l] = y & 1;y >>= 1;}len = max(len, l);int res = dp(len, 1, 1);return dp(len, 1, 1);}void Luogu_UID_748509() {5 行未改动