黑马程序员 基础测试题

您所在的位置:网站首页 黑马程序员入学考试 黑马程序员 基础测试题

黑马程序员 基础测试题

#黑马程序员 基础测试题| 来源: 网络整理| 查看: 265

public class Test1 {

/** * 第1题:求斐波那契数列第n项,n= 30 || n // TODO Auto-generated method stub System.out.println(function(60*60*24+1));// 调用函数并打印 }

// 计算时间函数 public static String function(int number) { String strDate = "键盘输入" + number + ",打印"; int final_day = 60 * 60 * 24;// 天 int final_h = 60 * 60;// 小时 int day = number / final_day; int h = (number % final_day) / final_h; int min = ((number % final_day) % final_h) / 60;// 分钟 int s = ((number % final_day) % final_h) % 60;// 秒 if (day > 0) { strDate = strDate + day + "天"; } if (h > 0) { strDate = strDate + h + "小时"; } if (min > 0) { strDate = strDate + min + "分钟"; } if (s > 0) { strDate = strDate + s + "秒"; } return strDate + ";"; } }

-------------------------------------------------------------------------------------------------------------------------------------------------------------

public class Test3 {

/** * 3、 请列举您了解的一些排序算法,并用Java语言实现一个效率较高的。 * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int arr[] = {1,3,5,7,9,8,6,4,2}; print(function(arr));

} /** * 对数组进行排序 :选择排序 * @param arr无须数组 * @return 排好序的数组 */ public static int[] function(int[] arr) { int len = arr.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3