奶头挺立呻吟高潮av全片,成人试看120秒体验区,性欧美极品v,A片高潮抽搐揉捏奶头视频

C語言

KMP算法的C#實現(xiàn)方法

時間:2025-04-11 07:29:57 C語言 我要投稿
  • 相關(guān)推薦

KMP算法的C#實現(xiàn)方法

  如何運用KMP算法實現(xiàn)C#呢?下面小編為大家整理了KMP算法的C#實現(xiàn)方法,希望能幫到大家!

  C#實現(xiàn)大數(shù)字的運算

  1、添加引用:System.Numerics.dll

  2、添加命名空間:using System.Numerics;

  3、實例:

  3.1判斷一個數(shù)字是不是質(zhì)數(shù)

  復(fù)制代碼 代碼如下:

  static void Main(string[] args)

  {

  Console.WriteLine("請輸入一個很大的數(shù)字:");

  string bigNumber = Console.ReadLine();

  BigInteger bigInteger = BigInteger.Parse(bigNumber);

  bool isNumber=false;

  for (BigInteger i = 2; i < BigInteger.Pow(bigInteger, 2);i++ )

  {

  if (bigInteger % i == 0)

  {

  isNumber = true;

  break;

  }

  }

  if (isNumber)

  {

  Console.WriteLine("不是質(zhì)數(shù)");

  }

  else

  {

  Console.WriteLine("是質(zhì)數(shù)");

  }

  Console.ReadLine();

  }

  3.2實現(xiàn)兩個大數(shù)的加減乘除

  復(fù)制代碼 代碼如下:

  static void Main(string[] args)

  {

  Console.Write("請輸入第一個大數(shù)字:");

  string bigNum1 = Console.ReadLine();

  BigInteger bigInt1 = BigInteger.Parse(bigNum1);

  Console.Write("請輸入第二個大數(shù)字:");

  string bigNum2 = Console.ReadLine();

  BigInteger bigInt2 = BigInteger.Parse(bigNum2);

  Console.Write(Environment.NewLine);

  BigInteger addNum = bigInt1 + bigInt2;

  BigInteger subNum = bigInt1 - bigInt2;

  BigInteger purNum = bigInt1 * bigInt2;

  BigInteger divNum = bigInt1 / bigInt2;

  Console.WriteLine("兩大數(shù)相加結(jié)果為:{0}",addNum);

  Console.WriteLine("兩大數(shù)相減結(jié)果為:{0}",subNum);

  Console.WriteLine("兩大數(shù)相乘結(jié)果為:{0}",purNum);

  Console.WriteLine("兩大數(shù)相除結(jié)果為:{0}",divNum);

  Console.ReadLine();

  }

【KMP算法的C#實現(xiàn)方法】相關(guān)文章:

C語言中實現(xiàn)KMP算法實例08-09

c#實現(xiàn)sunday算法實例08-07

c#實現(xiàn)輪詢算法實例代碼05-31

快速排序算法及C#版的實現(xiàn)示例07-03

C#實現(xiàn)協(xié)同過濾算法的實例代碼06-19

c#快速排序算法10-21

c#冒泡排序算法08-15

C#抽象工廠模式的幾種實現(xiàn)方法及比較10-20

java算法實現(xiàn)排列組合的方法介紹09-23

主站蜘蛛池模板: 荆州市| 盘锦市| 雷山县| 宜昌市| 通榆县| 赫章县| 车致| 中山市| 右玉县| 临颍县| 榕江县| 靖边县| 锡林浩特市| 萝北县| 尚志市| 苍梧县| 凤翔县| 伊通| 平武县| 贵南县| 克什克腾旗| 新丰县| 晋宁县| 马龙县| 信阳市| 宁津县| 南召县| 喀喇沁旗| 垣曲县| 太仆寺旗| 平定县| 阳泉市| 丽江市| 剑阁县| 南通市| 神池县| 邛崃市| 嘉禾县| 泰和县| 桦南县| 班戈县|