摘要: *公共汽车上的人数 *城市里有一辆公共汽车在行驶,每一个公共汽车站都要接送一些人。 *将为您提供整数数组(或元组)的列表(或数组)。每个整数数组有两个项,分别表示公共汽车站上车人数(第一项)和下车人数(第二项)。 *您的任务是返回最后一个公共汽车站(最后一个数组之后)之后仍在公共汽车上的人数。即使这 阅读全文
posted @ 2020-06-23 17:53 BORS 阅读(320) 评论(0) 推荐(0)
摘要: 从数字字符串中找到最大值和最小值 /** * find the max and min from String */ public static String highAndLow(String numbers) { String retStr = ""; String[] strAry = num 阅读全文
posted @ 2020-06-23 17:42 BORS 阅读(1182) 评论(0) 推荐(0)
摘要: *售票员 *新的《复仇者》电影刚刚上映!电影院售票处有很多人排起了长队。他们每人有一张100、50或25美元的钞票(每人只有一张纸币)。一张“复仇者”的票要25美元。 *瓦西娅目前是一名职员。他想把票卖给这一行的每一个人。 *如果瓦西娅一开始没有钱,而且严格按照人们排队的顺序售票,他能不能给每个人一 阅读全文
posted @ 2020-06-23 17:39 BORS 阅读(287) 评论(0) 推荐(0)
摘要: * 通过列出前六个质数:2,3,5,7,11和13,我们可以看到第六个质数是13。* * (输出第n个质数)第10001个质数是什么? public static int findPrime(int n) { int prime = 2, i = 1; while (true) { i++; if 阅读全文
posted @ 2020-06-23 17:23 BORS 阅读(337) 评论(0) 推荐(0)
摘要: 已知:* The sum of the squares of the first ten natural numbers is, * 1^2+2^2+...+10^2=385 * The square of the sum of the first ten natural numbers is, * 阅读全文
posted @ 2020-06-23 17:21 BORS 阅读(291) 评论(0) 推荐(0)
摘要: 已知:2520是可以被1到10中的每一个数除而没有任何余数的最小数。求:能被1到20之间的所有数字整除的最小正数是多少? 232792560 public static int getMinPositiveNum(int in_num) { for (int n = in_num; ; n++) { 阅读全文
posted @ 2020-06-23 17:16 BORS 阅读(568) 评论(0) 推荐(0)
摘要: 给出:斐波那契数列:1、1、2、3、5、8、13、21、34...输入几(n),输出对应位上的数值 public static int feibonaqie2(int n) { int n1 = 1; int n2 = 1; int n3 = 2; if (n <= 0) { return 0; } 阅读全文
posted @ 2020-06-23 17:13 BORS 阅读(178) 评论(0) 推荐(0)
bors