C++合成位数并求质数

作者在 2020-02-22 21:05:15 发布以下内容


void 合成位数并求质数()
{//缘由https://bbs.bccn.net/viewthread.php?tid=499357&pid=2719481&page=1#pid2719481 
 int shu[100]{0}, xu = 0, ge = 0, wei = 0, he = 0, mu = 1, j = 0;
 cin >> ge >> wei;
 while (xu<ge)cin >> shu[xu++]; xu = wei;
 while (j<ge - 2)if (xu)he += shu[--xu + j] * mu, mu *= 10; else shu[j++] = he, he = 0, mu = 1, xu = wei;
 xu = 0; mu = 2, he = sqrt(shu[xu]);
 while (xu<ge - 2)if (mu <= he)if (shu[xu] % mu)mu += (mu>2 ? 2 : 1); 
 else he = sqrt(shu[++xu]), mu = 2; else cout << shu[xu] << ends, he = sqrt(shu[++xu]), mu = 2;
}

无标题.png (上传于2020-02-22 21:11:17)
无标题.png



默认分类 | 阅读 1258 次
文章评论,共0条
游客请输入验证码