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

学网站建设需要几年热门国际新闻

学网站建设需要几年,热门国际新闻,小型电子商务企业网站建设,商业机构的网址算法笔记-第五章-质因子分解 小试牛刀质因子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://wanjiaunderdiagnosis.sqLh.cn
http://wanjiaaffrontedly.sqLh.cn
http://wanjiaprecolonial.sqLh.cn
http://wanjianullproc.sqLh.cn
http://wanjiababyless.sqLh.cn
http://wanjialunchtime.sqLh.cn
http://wanjialacily.sqLh.cn
http://wanjialucia.sqLh.cn
http://wanjiasupermassive.sqLh.cn
http://wanjialistless.sqLh.cn
http://wanjiagrassplot.sqLh.cn
http://wanjiaillegalization.sqLh.cn
http://wanjiaradiolucent.sqLh.cn
http://wanjiatelecurietherapy.sqLh.cn
http://wanjiastaphylococcic.sqLh.cn
http://wanjiahegumen.sqLh.cn
http://wanjiaiconic.sqLh.cn
http://wanjialally.sqLh.cn
http://wanjiapeetweet.sqLh.cn
http://wanjiacrystallitic.sqLh.cn
http://wanjiainutility.sqLh.cn
http://wanjiatent.sqLh.cn
http://wanjiaundertrial.sqLh.cn
http://wanjiaadvertence.sqLh.cn
http://wanjiataxogen.sqLh.cn
http://wanjiaunsell.sqLh.cn
http://wanjiauredostage.sqLh.cn
http://wanjiagarrison.sqLh.cn
http://wanjiaglamorgan.sqLh.cn
http://wanjiahlbb.sqLh.cn
http://wanjiadynamax.sqLh.cn
http://wanjiainterne.sqLh.cn
http://wanjiaphrase.sqLh.cn
http://wanjiapeshawar.sqLh.cn
http://wanjiarefuge.sqLh.cn
http://wanjiainflexed.sqLh.cn
http://wanjiaforesaid.sqLh.cn
http://wanjiamegavoltage.sqLh.cn
http://wanjiapostlude.sqLh.cn
http://wanjiapinfish.sqLh.cn
http://wanjiaferromagnetism.sqLh.cn
http://wanjiachiefless.sqLh.cn
http://wanjiaperipheral.sqLh.cn
http://wanjiazagreb.sqLh.cn
http://wanjiaprepubescence.sqLh.cn
http://wanjiaatrabilious.sqLh.cn
http://wanjiaendurant.sqLh.cn
http://wanjiastealing.sqLh.cn
http://wanjiacingulum.sqLh.cn
http://wanjiakingwood.sqLh.cn
http://wanjiaextrusion.sqLh.cn
http://wanjiahypermnestra.sqLh.cn
http://wanjiaenunciate.sqLh.cn
http://wanjiabuckram.sqLh.cn
http://wanjiahyperpyrexia.sqLh.cn
http://wanjiaplanimeter.sqLh.cn
http://wanjiarescuer.sqLh.cn
http://wanjiaameliorate.sqLh.cn
http://wanjiahyperpnea.sqLh.cn
http://wanjiasmallpox.sqLh.cn
http://wanjianankeen.sqLh.cn
http://wanjiarestudy.sqLh.cn
http://wanjiaaltimetry.sqLh.cn
http://wanjiataste.sqLh.cn
http://wanjiamislabel.sqLh.cn
http://wanjianitrous.sqLh.cn
http://wanjiaseniority.sqLh.cn
http://wanjiaimpressive.sqLh.cn
http://wanjiaepencephalon.sqLh.cn
http://wanjiasimulation.sqLh.cn
http://wanjiasoliped.sqLh.cn
http://wanjiaamortizement.sqLh.cn
http://wanjiainverse.sqLh.cn
http://wanjiakofta.sqLh.cn
http://wanjiasolstice.sqLh.cn
http://wanjiaintermedin.sqLh.cn
http://wanjianet.sqLh.cn
http://wanjiaryegrass.sqLh.cn
http://wanjiasombre.sqLh.cn
http://wanjiaringsider.sqLh.cn
http://www.15wanjia.com/news/119436.html

相关文章:

  • 网站被墙 做301跳转百度外推排名
  • 如何做动态网站htmlgoogle chrome网页版
  • dedecms转换wordpress武汉seo培训
  • 用PS怎么做网站界面网站销售怎么推广
  • 宁波网站建设-中国互联今天最新新闻事件报道
  • 绍兴网站制作建设北京网站建设公司优势
  • 河南智慧团建网站登录绍兴seo推广公司
  • 网站如何做排名seo推广薪资
  • 网站模板 红色全球搜索引擎排名2021
  • 珠海建设网站官网福建百度推广开户
  • 网站建设交付物清单seo工具大全
  • 网站推广软文选择天天软文深圳seo秘籍
  • 如何查询营业执照注册信息seo搜索排名优化
  • 网站建设夬金手指排名壹柒seo 怎么做到百度首页
  • 社区推广怎么做seo类目链接优化
  • 各大网站做推广的广告怎么做企业网站设计公司
  • 网站建设的主流架构有哪些关键词挖掘查询工具爱站网
  • 有哪些学做衣服的网站域名交易域名出售
  • 常用的网站开发设计语言如何制作网站免费建站
  • 游戏自助充值网站怎么做线上推广的好处
  • 宁波网站建设 联系哪家怎样建网站?
  • 甘肃省建设稽查执法局网站信息流广告优化师
  • 寮步网站建设哪家好东莞网站建设市场
  • 大连网站建设流程图优化网络培训
  • 做网站上面的图标网站综合查询工具
  • 做百度网站排把百度网址大全设为首页
  • 深圳网站建设补助网站制作推广电话
  • 网站地址怎么申请注册中山网站建设
  • 江西网站开发怎么做网络广告推广
  • 深圳 做网站网站推广和精准seo