[补漏]shift&算法


  • 题意:regular number
    给你一个字符串,要你输出所有(每位都符合要求的)子串,输入时告诉你每位只能填的数集。
  • 思路:
    bitsetc[x]存每个数字可以存在的字符串位的二进制集合。(如3可以在字符串第0,3,5出现则为:101001)
    bitsetdp第i位表示当前位开始往前i位是否合法。
    dp就每次左移再&上c[当前字符],感觉非常地合理
  • 代码:
#include
using namespace std;
const int N=1e3+5;
const int M=5e6+5;
bitsetc[N],dp;
char s[M];
string ans;
int main() {
	int n;
	scanf("%d",&n);
	for(int i=0;i