1. 首页
  2. 技术
  3. 后台

C++合成位数并求质数

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)


C++合成位数并求质数

原创文章,作者:xianfajushi的博客,如若转载,请注明出处:https://www.zengqueling.com/c%e5%90%88%e6%88%90%e4%bd%8d%e6%95%b0%e5%b9%b6%e6%b1%82%e8%b4%a8%e6%95%b0/

联系我们

15602395067

在线咨询:点击这里给我发消息

邮件:eden7@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code