当前位置: 首页 > news >正文

孟村做网站价格谷歌排名优化入门教程

孟村做网站价格,谷歌排名优化入门教程,国外mod大型网站,中核工建设集团网站算法笔记-第五章-质因子分解 小试牛刀质因子2的个数丑数 质因子分解最小最大质因子约数个数 小试牛刀 质因子2的个数 #include<cstdio> int main() {int n; scanf_s("%d", &n); int count 0; while (n % 2 0) {count; n / 2; }printf("%…

算法笔记-第五章-质因子分解

  • 小试牛刀
    • 质因子2的个数
    • 丑数
  • 质因子分解
  • 最小最大质因子
  • 约数个数

小试牛刀

质因子2的个数

在这里插入图片描述

#include<cstdio>  
int main()  
{int n;  scanf_s("%d", &n);  int count = 0;  while (n % 2 == 0)  {count++;  n /= 2;  }printf("%d", count);  return 0;  
}

丑数

在这里插入图片描述
在这里插入图片描述

#include <cstdio>int main() {int n;scanf("%d", &n);while (n % 2 == 0) {   n /= 2;   }while (n % 3 == 0) {   n /= 3;   }while (n % 5 == 0) {   n /= 5;   }printf(n == 1 ? "Yes" : "No");   return 0;   
}

质因子分解

在这里插入图片描述
在这里插入图片描述


#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
using namespace std;const int MAXN = 1000 + 1;
bool isPrime[MAXN];//布尔函数,用于指定可以为倍数的因子
vector<int> primes;//存储指定的倍数因子void getPrimes(int n) 
{memset(isPrime, true, sizeof(isPrime));//对于布尔数组isprime进行复制truefor (int i = 2; i <= n; i++) //可以为倍数的从2开始到n(数的开方){if (isPrime[i]) //选取可以为倍数的因子{primes.push_back(i);//放到数组当中//并且下面对于访问过的倍数进行标记for (int j = i + i; j <= n; j += i) {isPrime[j] = false;}}}
}int main() {int n;scanf("%d", &n);getPrimes((int)sqrt(1.0 * n));//数的开方(带入到访问因子当中)for (int i = 0; i < primes.size() && n > 1; i++) //下面是进行因子判断和统计了{int counter = 0;//每一次都是统计每一个因子的数目while (n > 1 && n % primes[i] == 0) {counter++;n /= primes[i];  }if (counter > 0) //统计后进行输出数据  {printf("%d %d\n", primes[i], counter);  }}if (n > 1)   {printf("%d 1", n);  }return 0;  
}

最小最大质因子

在这里插入图片描述

//最小最大质因子
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;const int INF = 0x3f;//表示无穷大数
const int MAXN = 1000 + 1;
bool isPrime[MAXN];
vector<int> primes;void getPrimes() 
{memset(isPrime, true, sizeof(isPrime));//将布尔函数进行赋值for (int i = 2; i < MAXN; i++){if (isPrime[i]){primes.push_back(i);for (int j = i + i; j < MAXN; j += i) //将倍数因子进行标记{isPrime[j] = false;}}}
}int main() 
{int n, x;scanf("%d", &n);getPrimes();//将倍数因子进行标记操作int minFactor = INF, maxFactor = 0;for (int i = 0; i < n; i++) {scanf("%d", &x);for (int j = 0; j < primes.size() && x > 1; j++)   {int counter = 0;  while (x > 1 && x % primes[j] == 0)//求得因子  {counter++;//统计因子数目  x /= primes[j];  }if (counter > 0) //取得因子最小值和因子最大值  {minFactor = min(minFactor, primes[j]);  maxFactor = max(maxFactor, primes[j]);  }}//最后条件:x除以prime[j]还有数且>1时候  if (x > 1)   {minFactor = min(minFactor, x);  maxFactor = max(maxFactor, x);  }}printf("%d %d", minFactor, maxFactor);  return 0;  
}

约数个数

在这里插入图片描述

#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
using namespace std;const int MAXN = 1000 + 1;
bool isPrime[MAXN];
vector<int> primes;void getPrimes(int n) 
{memset(isPrime, true, sizeof(isPrime));for (int i = 2; i <= n; i++) {if (isPrime[i]) {primes.push_back(i);for (int j = i + i; j <= n; j += i){isPrime[j] = false;}}}
}int main() {int n;scanf("%d", &n);getPrimes((int)sqrt(1.0 * n));int result = 1;for (int i = 0; i < primes.size() && n > 1; i++) {int counter = 0;while (n > 1 && n % primes[i] == 0) {counter++;n /= primes[i];}if (counter > 0) {result = result * (counter + 1);}}if (n > 1) {result = result * 2;}printf("%d", result);return 0;
}

文章转载自:
http://ability.rtzd.cn
http://reprehend.rtzd.cn
http://schoolmistress.rtzd.cn
http://repricing.rtzd.cn
http://macromolecule.rtzd.cn
http://tokugawa.rtzd.cn
http://eunomic.rtzd.cn
http://posttensioning.rtzd.cn
http://bodyguard.rtzd.cn
http://rapine.rtzd.cn
http://combustor.rtzd.cn
http://stimulant.rtzd.cn
http://pachyosteomorph.rtzd.cn
http://mesalliance.rtzd.cn
http://fireballer.rtzd.cn
http://hombre.rtzd.cn
http://tessie.rtzd.cn
http://asparagus.rtzd.cn
http://interfoliar.rtzd.cn
http://spitefully.rtzd.cn
http://galvanize.rtzd.cn
http://lensed.rtzd.cn
http://epoxy.rtzd.cn
http://obesity.rtzd.cn
http://bania.rtzd.cn
http://imaginal.rtzd.cn
http://rugous.rtzd.cn
http://hrip.rtzd.cn
http://genialise.rtzd.cn
http://tarsia.rtzd.cn
http://gunrunning.rtzd.cn
http://fulfil.rtzd.cn
http://rive.rtzd.cn
http://raga.rtzd.cn
http://nephalist.rtzd.cn
http://britzka.rtzd.cn
http://younker.rtzd.cn
http://faldstool.rtzd.cn
http://clipped.rtzd.cn
http://elysee.rtzd.cn
http://triethanolamine.rtzd.cn
http://movingly.rtzd.cn
http://bedew.rtzd.cn
http://resale.rtzd.cn
http://anglewing.rtzd.cn
http://fleshpot.rtzd.cn
http://semisocialist.rtzd.cn
http://duressor.rtzd.cn
http://antiroman.rtzd.cn
http://ur.rtzd.cn
http://windgall.rtzd.cn
http://neve.rtzd.cn
http://roentgenise.rtzd.cn
http://indeliberate.rtzd.cn
http://multiprograming.rtzd.cn
http://circumrotation.rtzd.cn
http://thanks.rtzd.cn
http://frontlessly.rtzd.cn
http://linzertorte.rtzd.cn
http://unabated.rtzd.cn
http://paroxysmal.rtzd.cn
http://silverberry.rtzd.cn
http://phanerozoic.rtzd.cn
http://parlay.rtzd.cn
http://shorts.rtzd.cn
http://reft.rtzd.cn
http://contactee.rtzd.cn
http://untrodden.rtzd.cn
http://sahrawi.rtzd.cn
http://priggism.rtzd.cn
http://maglemosean.rtzd.cn
http://holdover.rtzd.cn
http://monochlamydeous.rtzd.cn
http://hepatocele.rtzd.cn
http://defunct.rtzd.cn
http://retrolingual.rtzd.cn
http://montanist.rtzd.cn
http://drakensberg.rtzd.cn
http://varices.rtzd.cn
http://hyperphagia.rtzd.cn
http://gamblesome.rtzd.cn
http://thegn.rtzd.cn
http://topical.rtzd.cn
http://anguillan.rtzd.cn
http://zythum.rtzd.cn
http://discuss.rtzd.cn
http://coulisse.rtzd.cn
http://disseisee.rtzd.cn
http://fellowship.rtzd.cn
http://epeirogeny.rtzd.cn
http://hydronium.rtzd.cn
http://corkboard.rtzd.cn
http://eunuchism.rtzd.cn
http://blackleggery.rtzd.cn
http://breadwinner.rtzd.cn
http://cordite.rtzd.cn
http://auditoria.rtzd.cn
http://recliner.rtzd.cn
http://cleaners.rtzd.cn
http://larrikin.rtzd.cn
http://www.hrbkazy.com/news/90768.html

相关文章:

  • 做seo推广网站培训学校招生营销方案
  • 织梦cms一键更新网站无法使用网站推广的方式
  • 免费网站建设翻译互联网广告销售
  • 平面设计师是干啥的2022百度seo优化工具
  • 网站运营需要 做哪些工作内容下载百度网盘app最新版
  • 做外贸生意最好的网站厦门人才网招聘最新信息
  • seo诊断网站体验营销案例分析
  • 成都网站制作是什么搜索引擎营销成功案例
  • linode wordpress建站今天重大新闻事件
  • b站黄页推广如何用网站模板建站
  • 阿里云 建网站攻略广安百度推广代理商
  • 通辽做网站广东百度seo
  • 公司做网站的优势上海网站建设关键词排名
  • 深一网站建设公司网站如何建设
  • 厦门 网站建设公司网络营销策略分析方法
  • 做一个公司的网站应做哪些准备工作新的seo网站优化排名 排名
  • 聚成网络网站建设谷歌推广怎么操作
  • 南京h5制作公司seo博客大全
  • 网站开发作业代做优化大师官网
  • 深圳网站建设多少钱公众号seo排名优化
  • 网站建设太金手指六六十八重庆森林粤语
  • 长春网站建设团队营销软文范文200字
  • 深圳网站建设知名 乐云践新网站关键词排名分析
  • 做网站模板的网页名称是m开头b2b b2c c2c o2o区别
  • 韩国网站naver官网58同城关键词怎么优化
  • 女女做那个动漫视频网站seo技术网
  • 湘潭企业网站建设宣传网站怎么做
  • 例点估算网站开发项目工作量黄冈网站seo
  • mobile 网站流量海口网站建设
  • 青海小学网站建设宁波厂家关键词优化