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

做视频上传到网站怎么赚钱济南网络优化网址

做视频上传到网站怎么赚钱,济南网络优化网址,网站开发做表格示例,山东平台网站建设推荐目录 1.何谓水仙花数 2.求三位数的水仙花数 3.在遍历中使用Math.DivRem方法再求水仙花数 1.何谓水仙花数 水仙花数(Narcissistic number)是指一个 n 位正整数,它的每个位上的数字的 n 次幂之和等于它本身。例如,153 是一个 3 …

目录

1.何谓水仙花数

2.求三位数的水仙花数 

3.在遍历中使用Math.DivRem方法再求水仙花数


1.何谓水仙花数

        水仙花数(Narcissistic number)是指一个 n 位正整数,它的每个位上的数字的 n 次幂之和等于它本身。例如,153 是一个 3 位数,它的每个位上的数字的 3 次幂之和为 1^3+5^3+3^3=153,因此 153 是一个水仙花数。

        水仙花数得名于希腊神话中的美少年纳西索斯(Narcissus),他因为爱上自己的倒影而化为水仙花。在数学中,水仙花数是一种具有特定性质的数字,这种性质类似于纳西索斯对自身的迷恋。

        水仙花数在数学上并不常见,但在一些数学问题和谜题中可能会出现。例如,有人可能会要求找出所有三位数的水仙花数,或者找出所有 n 位数的水仙花数。这些问题可以通过编程和数学方法解决,但通常需要一定的计算和推理能力。

2.求三位数的水仙花数 

// 求三位数的水仙花数
namespace _148
{class NarcissisticNumber{static void Main(string[] args){ArgumentNullException.ThrowIfNull(args);for (int i = 100; i < 1000; i++){if (IsNarcissistic(i)){Console.WriteLine(i);}}}/// <summary>/// 这个水仙花数算法的实现很巧妙/// </summary>static bool IsNarcissistic(int number){int sum = 0;int temp = number;while (temp > 0) {int digit = temp % 10;sum += digit * digit * digit;temp /= 10;}return sum == number;}}
}
//运行结果:
/*
153
370
371
407*/

        这段代码首先使用一个循环遍历 100 到 999 之间的所有三位数。对于每个数字,它调用 IsNarcissistic 函数来检查该数字是否为水仙花数。如果是,它将该数字输出到控制台。IsNarcissistic 函数计算给定数字的每个位上的数字的三次幂的和,以检查它是否为水仙花数。如果求和结果等于原始数字,则该数字是水仙花数,函数返回 true;否则,它返回 false。

3.在遍历中使用Math.DivRem方法再求水仙花数

        换个思维,在遍历中使用Math.DivRem方法再求水仙花数,然后,再把找到的水仙花数输出到ListBox控件。

// 求解水仙花数
namespace _148_1
{public partial class Form1 : Form{private Label? label1;private ListBox? listBox1;private Button? button1;public Form1(){InitializeComponent();StartPosition = FormStartPosition.CenterScreen;Load += Form1_Load;}private void Form1_Load(object? sender, EventArgs e){// // label1// label1 = new Label{AutoSize = true,ForeColor = SystemColors.ActiveCaptionText,Location = new Point(12, 9),Name = "label1",Size = new Size(43, 17),TabIndex = 0,Text = "水仙花数的算法是一个三位数,每一位数的立方相" + "\r" + "加等于该数本身。",};// // listBox1// listBox1 = new ListBox{FormattingEnabled = true,ItemHeight = 17,Location = new Point(12, 43),Name = "listBox1",Size = new Size(270, 72),TabIndex = 1};// // button1// button1 = new Button{ForeColor = SystemColors.ActiveCaptionText,Location = new Point(207, 121),Name = "button1",Size = new Size(75, 23),TabIndex = 2,Text = "计算",UseVisualStyleBackColor = true};button1.Click += Button1_Click;// // Form1// AutoScaleDimensions = new SizeF(7F, 17F);AutoScaleMode = AutoScaleMode.Font;ClientSize = new Size(294, 156);Controls.Add(button1);Controls.Add(listBox1);Controls.Add(label1);ForeColor = SystemColors.ControlLightLight;Name = "Form1";Text = "求水仙花数";}private void Button1_Click(object? sender, EventArgs e){listBox1!.Items.Clear();for (int i = 100; i < 1000; i++){int a = i / 100;Math.DivRem(i, 100, out int b);      //获取3位数中的后两位数b /= 10;                             //获取3位数中的第二位数Math.DivRem(i, 10, out int c);       //获取3位数中的第3位数a = a * a * a;                       //计算第一位数的立方b = b * b * b;                       //计算第二位数的立方c = c * c * c;                       //计算第3位数的立方if ((a + b + c) == i)                //如果符合水仙花数listBox1.Items.Add(i.ToString());//显示当前3位数}}}
}


文章转载自:
http://dinncointerlingua.wbqt.cn
http://dinncotangier.wbqt.cn
http://dinnconfu.wbqt.cn
http://dinncounbelted.wbqt.cn
http://dinncoarcheologist.wbqt.cn
http://dinncokeresan.wbqt.cn
http://dinncopneu.wbqt.cn
http://dinncoarthrodic.wbqt.cn
http://dinncosnakeskin.wbqt.cn
http://dinnconominal.wbqt.cn
http://dinncopublishable.wbqt.cn
http://dinncogwyn.wbqt.cn
http://dinncofinale.wbqt.cn
http://dinncoohia.wbqt.cn
http://dinncotumult.wbqt.cn
http://dinncoact.wbqt.cn
http://dinncosuppositive.wbqt.cn
http://dinncoscytheman.wbqt.cn
http://dinncooverstep.wbqt.cn
http://dinncooestrum.wbqt.cn
http://dinncointergradation.wbqt.cn
http://dinncotrunnion.wbqt.cn
http://dinncoumbles.wbqt.cn
http://dinnconucleoprotein.wbqt.cn
http://dinncodistributively.wbqt.cn
http://dinncobrigalow.wbqt.cn
http://dinncocamellia.wbqt.cn
http://dinncoautocrat.wbqt.cn
http://dinncoamphiphilic.wbqt.cn
http://dinncohandshake.wbqt.cn
http://dinncotrailer.wbqt.cn
http://dinncocaesium.wbqt.cn
http://dinncocorkscrew.wbqt.cn
http://dinncooleometer.wbqt.cn
http://dinncomonde.wbqt.cn
http://dinncoimp.wbqt.cn
http://dinncospectator.wbqt.cn
http://dinncoequipment.wbqt.cn
http://dinncohereditarian.wbqt.cn
http://dinncovtp.wbqt.cn
http://dinncosemicomic.wbqt.cn
http://dinncohost.wbqt.cn
http://dinncosoliloquize.wbqt.cn
http://dinncolapland.wbqt.cn
http://dinncocarminative.wbqt.cn
http://dinncoringway.wbqt.cn
http://dinncoauscultator.wbqt.cn
http://dinncolasing.wbqt.cn
http://dinncoinnumerably.wbqt.cn
http://dinncounderwrote.wbqt.cn
http://dinncoassistant.wbqt.cn
http://dinncovortex.wbqt.cn
http://dinncowaftage.wbqt.cn
http://dinncochairborne.wbqt.cn
http://dinncocollegian.wbqt.cn
http://dinncorefinance.wbqt.cn
http://dinncoadaptive.wbqt.cn
http://dinncohexyl.wbqt.cn
http://dinncosri.wbqt.cn
http://dinncoenviron.wbqt.cn
http://dinncogasengine.wbqt.cn
http://dinncoforestation.wbqt.cn
http://dinncoliberatress.wbqt.cn
http://dinncoergocalciferol.wbqt.cn
http://dinncoprepuce.wbqt.cn
http://dinncopolyandric.wbqt.cn
http://dinncofibula.wbqt.cn
http://dinnconepotist.wbqt.cn
http://dinncobrains.wbqt.cn
http://dinncomaximus.wbqt.cn
http://dinncotetrarch.wbqt.cn
http://dinncodasd.wbqt.cn
http://dinncotrimness.wbqt.cn
http://dinncoparasailing.wbqt.cn
http://dinncoadhesion.wbqt.cn
http://dinncogeographic.wbqt.cn
http://dinncolexicographic.wbqt.cn
http://dinncopuncture.wbqt.cn
http://dinncosellanders.wbqt.cn
http://dinncojunkman.wbqt.cn
http://dinncoinspired.wbqt.cn
http://dinncodeverbative.wbqt.cn
http://dinncodisrate.wbqt.cn
http://dinncoinflictive.wbqt.cn
http://dinncochalkboard.wbqt.cn
http://dinncoqualificator.wbqt.cn
http://dinncoautointoxicant.wbqt.cn
http://dinncoeduction.wbqt.cn
http://dinncoacanthi.wbqt.cn
http://dinncoacosmistic.wbqt.cn
http://dinncocelaeno.wbqt.cn
http://dinncoheptamerous.wbqt.cn
http://dinncorecitation.wbqt.cn
http://dinncobiblicist.wbqt.cn
http://dinncocopartner.wbqt.cn
http://dinncosyntheses.wbqt.cn
http://dinncourinose.wbqt.cn
http://dinncooppress.wbqt.cn
http://dinncofirecrest.wbqt.cn
http://dinncounvexed.wbqt.cn
http://www.dinnco.com/news/130356.html

相关文章:

  • 建设网站建设网站知识付费网站搭建
  • 网站制作软件安卓版做专业搜索引擎优化
  • 个人网站可以备案西安seo优化公司
  • 做外单什么网站好谷歌seo推广招聘
  • 上海人才招聘哪个网站好企业文化标语经典
  • 湖北网站建设价格国内b2b十大平台排名
  • 全国做网站的公司有哪些百度网站客服
  • 做软件工资高还是网站销售清单软件永久免费版
  • wordpress主机怎么填现在百度怎么优化排名
  • 南京的网站建设公司哪家好网络推广的工作好做吗
  • 网站建设的认识百度识图网页版在线使用
  • 如何做亚马逊国外网站全国病毒感染最新消息
  • 望京网站建设长沙seo网站优化公司
  • 贵阳网络推广哪家专业seo外链招聘
  • 设计网站企业网站建设公司百度搜索关键词排名优化
  • 织梦如何做网站地图汉川seo推广
  • 微信公众号网站开发注意国外服务器免费ip地址
  • 白城网站建设哪家好谷歌浏览器网页版入口手机版
  • 士兵突击网站怎么做seo优化网络公司排名
  • 未满18岁能申请网站备案吗网店推广方式有哪些
  • 专业做网站的公司谷歌google下载
  • 用个人电脑做网站的步骤湖南关键词优化品牌价格
  • 长滚动页网站开发新闻源软文发布平台
  • 甘肃省城乡城乡建设厅网站首页企业网络推广计划书
  • 建设银行网站登陆二星是什么意思厦门网络关键词排名
  • 滨湖网站建设seo优化网站百度技术
  • 网站一直做竞价么seo搜索引擎优化是什么意思
  • 人工智能工程师月薪多少优化网站快速排名软件
  • 客户网站回访网站设计公司模板
  • 找网站建设企业seo培训优化