依然由2021-03-19 特殊日期连续3个相同数-CSDN博客修改而来。
使用FOR也一样:for(;b <= bb;)即可,这还解释?我写的每条语句已经很清晰了。
逻辑上1不等重新取样重新计数;2相等计数;3达到条件输出并开始下一个平方数;4都不符合开始下一个平方数。
void 特殊完全平方数()
{//缘由https://ask.csdn.net/questions/7408194?spm=1005.2025.3001.5141
int a = 10, b = a*a, c = 10, d = 0, e = 0, n = 0, aa = 0, bb = 0;
cin >> aa >> bb >> n;
while (b <= bb)
if (b && c != b % 10)
c = b % 10, d = 1, b /= 10;
else if (b && ++d < 2)
b /= 10;
else if (b && d >= 2)
(a*a >= aa && a*a <= bb ? ++e : 0),
//cout << (e == n ? "<" : "") << (a * a) << (e == n ? ">" : "") << ends,
(e == n ? cout << (a * a) << endl : cout << ""),
b = ++a * a, c = 10;
else
b = ++a * a, c = 10;
if (e < n)cout << endl << "No:" << e << endl;
}
标签:aa,03,平方,20,bb,10,2021 From: https://blog.csdn.net/xianfajushi/article/details/115034255