有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。 public class Example30 { public static void main(String[] args) { int[] m = { 3, 5, 9, 12, 16, 20, 25, 33 }; addEl Read More
posted @ 2017-06-06 11:59 本宫在,尔等都是妃 Views(205) Comments(0) Diggs(0) Edit
求一个3*3矩阵对角线元素之和。 public class Example29 { public static void main(String[] args) { int[][] a = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; sum(a); } pu Read More
posted @ 2017-06-06 11:58 本宫在,尔等都是妃 Views(145) Comments(0) Diggs(0) Edit
对10个数进行排序。 public class Example28 { public static void main(String[] args) { int[] s = { 5, 7, 6, 1, 9, 4, 2, 3, 8 }; BubbleSort(s); } public static v Read More
posted @ 2017-06-06 11:57 本宫在,尔等都是妃 Views(116) Comments(0) Diggs(0) Edit
求100之内的素数。 public class Example27 { public static void main(String[] args) { prime(); } public static void prime() { System.out.print(2 + "\t"); Syste Read More
posted @ 2017-06-06 11:56 本宫在,尔等都是妃 Views(125) Comments(0) Diggs(0) Edit
请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母。 public class Example26 { public static void main(String[] args) { f(); } public static void f() { System.o Read More
posted @ 2017-06-06 11:55 本宫在,尔等都是妃 Views(293) Comments(0) Diggs(0) Edit