C++包含整数各位重组

void 包含整数各位重组()
{//缘由https://bbs.csdn.net/topics/395402016
	int shu = 100000, bs = 4, bi = shu * bs, a = 0, p = 0, d = 0;
	while (shu < 500000)if (a<6 && (p = to_string(shu).find(to_string(bi)[a], p)) != string::npos && (d = to_string(bi).find(to_string(shu)[a], d)) != string::npos)
		p = d = 0, cout << (++a >= 6 ? to_string(shu) + "=" + to_string(bi) : "") << "\t"; else if ((bi = ++shu * bs)>999999)break; else a = p = d = 0;
}

之上可重复数字,之下不重复数字

void 包含整数各位重组()
{//缘由https://bbs.csdn.net/topics/395402016
	int shu = 100000, bs = 4, bi = shu * bs, a = 0;
	string aa = "";
	while (shu < 500000)if (a<6 && to_string(shu).find(to_string(bi)[a]) != string::npos && to_string(bi).find(to_string(shu)[a]) != string::npos && to_string(shu).find(to_string(shu)[a], a + 1) == string::npos)
		aa += (++a >= 6 ? to_string(shu) + "=" + to_string(bi) + " " : ""); else if ((bi = ++shu * bs)>999999)break; else a = 0;
	cout << aa << endl;//(aa += (++a >= 6 ? to_string(shu) + "=" + to_string(bi) + " " : ""))  Sleep(0), system("cls"), 
}

C++包含整数各位重组_第1张图片

你可能感兴趣的:(c++,算法,开发语言)