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

北京网站制作网站优化邢台装修网站建设

北京网站制作网站优化,邢台装修网站建设,网站做动态图片不显示,wordpress全景krpanoC#实验1-2 7-1 C# 1.6 求孪生素数 编写控制台应用程序#xff0c;查找一个用户输入的正整数区间中的孪生素数#xff08;孪生素数就是指相差2的素数对#xff09;。 输入格式: 用户在一行中输入两个正整数#xff0c;中间用一个空格间隔。 输出格式: 如果第二个数小于…C#实验1-2 7-1 C# 1.6 求孪生素数 编写控制台应用程序查找一个用户输入的正整数区间中的孪生素数孪生素数就是指相差2的素数对。 输入格式: 用户在一行中输入两个正整数中间用一个空格间隔。 输出格式: 如果第二个数小于或等于第一个数则输出“Inputting illegal characters” 如果第二个数大于第一个数则每行输出一组两个数的闭区间中的孪生素数对两个数之间用一个空格间隔。 输入样例: 在这里给出一组输入。例如 3 13输出样例: 在这里给出相应的输出。例如 3 5 5 7 11 13注意两点 : list 需要 using System.Collections.Generic 关于 split static void Main(string[] args){String[] input Console.ReadLine().Split( );foreach(var x in input){Console.WriteLine(x);}}stdin : 12 23 34 45 56 6552523 stdout : 12 23 34 45 56 6552523 using System; using System.Collections.Generic;namespace Solution {class Program{static bool is_prime(int x){if (x 1) return false;for(int i 2; i x / i; i){if (x % i 0) return false;}return true;}static void Main(string[] args){String[] input Console.ReadLine().Split( );int l, r;l Convert.ToInt32(input[0]);r Convert.ToInt32(input[1]);if(r l){Console.WriteLine(Inputting illegal characters);return;}Listint list new Listint();for(int i l; i r; i){if (is_prime(i)){list.Add(i);}}for(int i 0; i list.Count - 1; i){int number1 list[i];int number2 list[i 1];if (number2 - number1 2){Console.WriteLine(number1 number2);}}}} }7-2 C# 1.7 查找最高分及学生 编写控制台应用程序实现如下功能 1输入学生姓名英文字母组成和考试成绩推荐保存到结构体数组中。 2求最高分并输出对应的姓名推荐使用foreach语句。 输入格式: 第一行输入学生人数n 然后每一行输入一位同学的姓名和其考试成绩姓名和考试成绩之间用一个空格间隔。 一共输入n位同学的姓名和成绩。 输出格式: 第一行输出最高分。 第二行按用户录入信息的先后次序输出得最高分的同学姓名不同同学姓名之间用一个空格间隔。 输入样例: 在这里给出一组输入。例如 3 Lucy 89 Mark 70 Tom 89输出样例: 在这里给出相应的输出。例如 89 Lucy Tomusing System; using System.Collections.Generic;namespace StudentScores {class Program{struct Student{public string Name;public int Score;}static void Main(string[] args){int n Convert.ToInt32(Console.ReadLine());Student[] students new Student[n];for (int i 0; i n; i){string input Console.ReadLine();int spaceIndex input.IndexOf( );students[i].Name input.Substring(0, spaceIndex);students[i].Score Convert.ToInt32(input.Substring(spaceIndex 1));}int maxScore int.MinValue;foreach (var student in students){if (student.Score maxScore){maxScore student.Score;}}Console.WriteLine(maxScore);ListString res new Liststring();foreach (var student in students){if (student.Score maxScore){res.Add(student.Name);}}for(int i 0; i res.Count; i){Console.Write(res[i]);if (i ! res.Count - 1) Console.Write( );else Console.WriteLine();}}} }7-3 C# 1.8 体型判断 分支判断 using System;namespace Solution {class Program{static void Main(string[] args){double h, w, t;h Convert.ToDouble(Console.ReadLine());w Convert.ToDouble(Console.ReadLine());t w / h / h;if(t 18){Console.WriteLine(thin);}else if(t 18 t 25){Console.WriteLine(standard);}else if(t 25 t 27){Console.WriteLine(little fat);}else{Console.WriteLine(fat);}}} }7-4  C# 1.9 判定闰年 using System;namespace Solution {class Program{static void Main(string[] args){int year;year Convert.ToInt32(Console.ReadLine());if((year % 4 0 year % 100 ! 0) || (year % 400 0)){Console.WriteLine(Yes);}else{Console.WriteLine(No);}}} }7-5 C# 1.10 计算分段函数 与 7-3 重题 using System;namespace Solution {class Program{static void Main(string[] args){double x;x Convert.ToDouble(Console.ReadLine());if (x 0.4 x 1.4){Console.WriteLine(1.0 - 2.0 * x);}else if (x 2.4 x 4.4){Console.WriteLine(x);}else if(x 5.4 x 6.4){Console.WriteLine(1.0 2.0 * x);}}} }7-6 C# 1.11 打印杨辉三角 主要在于二维数组的应用 声明 : int[][] triangle new int[1000][]; 使用之前对于每一维 : triangle[i] new int[1000]; using System;namespace Solution {class Program{static void Main(string[] args){int n;n Convert.ToInt32(Console.ReadLine());int[][] triangle new int[1000][];// 初始化triangle[1] new int[1000];triangle[1][1] 1;// 递推for (int i 2; i n; i){triangle[i] new int[1000];for(int j 1; j i; j){triangle[i][j] triangle[i - 1][j - 1] triangle[i - 1][j];}}for (int i 1; i n; i){for (int j 1; j i; j){Console.Write(triangle[i][j]);if (j ! i) Console.Write( );else Console.WriteLine();}}}} }
http://www.zqtcl.cn/news/121190/

相关文章:

  • c .net怎么做网站如何进行账号推广
  • 网站建设丨金手指谷哥12怎么看网站做的外链
  • 一个空间建多个网站青海培训网站建设公司
  • 网站国际联网备案大型外贸网站建设
  • 淮南 小学网站建设软件技术主要学什么就业前景
  • 微网站建设网站洛阳制作网站公司哪家好
  • 凤翔做网站wordpress分销商城
  • 网站产品网页设计模板企业网站优化关键词
  • 电商网站建设去迅法网网站管理与建设试题
  • 做网站必须知道的问题wordpress制作论坛
  • 怎样在建设部网站查资质证书网页设计有哪些岗位
  • 安徽中色十二冶金建设有限公司网站cad制图初学入门
  • 开发网站监控工具网上开店怎么找货源
  • 标准网站建设报价单私密浏览器直播
  • wordpress焦点图网站seo分析
  • 域名申请哪个网站好江西有色建设集团有限公司网站
  • 新乡市做网站的公司百度推广开户费用多少
  • 免费建网站哪个平台好php 未定义函数wordpress
  • 个人网站 域名选择郑州那家做网站便宜
  • 网站建设技术合伙人的技术股份全国免费发布信息网站大全
  • 兼职网站平台有哪些新手怎么学做网站
  • 有没有直接做网站的软件iis一个文件夹配置多个网站
  • 网站怎么屏蔽ip访问信息发布网站建设
  • 陕西省住房城乡建设厅网站管理中心电信服务器
  • 外国优秀网站设计程序员做任务的网站
  • 购物网站项目经验开发一个游戏软件需要多少钱
  • 专业的大连网站建设电商网站支付方案
  • 手机如何建设网站首页株洲搜索引擎优化
  • 辉县市建设局网站制作网站站用的软件下载
  • 什么网站广告做多有没有不花钱建设网站的方法