项目作者: pj0579

项目描述 :
笔试题
高级语言:
项目地址: git://github.com/pj0579/NUMERCAL-TEST.git
创建时间: 2017-03-31T03:17:53Z
项目社区:https://github.com/pj0579/NUMERCAL-TEST

开源协议:

下载


test

笔试题
求解一个脉冲函数的先升后降最大区间

  1. public class Test {
  2. public void Sort(int[] number) {
  3. int[] arry = new int[number.length - 1];
  4. int count = 0;
  5. int max = 0;
  6. int start = 0;
  7. for (int i = 0; i < number.length - 1; i++) {
  8. if (i == 0) {
  9. if (number[i] < number[i + 1]) {
  10. arry[count] = i;
  11. count++;
  12. }
  13. } else {
  14. if (i == number.length - 2) {
  15. arry[count] = i;
  16. count++;
  17. } else {
  18. if (number[i] < number[i + 1] && (number[i] < number[i - 1])) {
  19. arry[count] = i;
  20. count++;
  21. }
  22. }
  23. }
  24. }
  25. for (int j = 0; j < arry.length - 1; j++) {
  26. if (arry[j] == 0) {
  27. } else {
  28. if ((arry[j] - arry[j - 1]) > max) {
  29. max = arry[j] - arry[j - 1];
  30. start = arry[j - 1];
  31. }
  32. }
  33. }
  34. if (start == 0 && max == 0) {
  35. System.out.println("最大区间为:" + "-1" + "到" + "-1");
  36. } else {
  37. System.out.println("最大区间为:" + start + "到" + (start + max + 1));
  38. }
  39. }
  40. public static void main(String[] args) {
  41. Test test = new Test();
  42. int[] arry = {3,44,55,66,9,8,7,6,5,4,3,2};
  43. test.Sort(arry);
  44. }
  45. }
2. a对应0 z对应25 26进制数 输出二十六进制对应的10进制数
  1. public class Main {
  2. public void numberTen(String s, HashMap map) {
  3. char[] c= s.toCharArray();
  4. int sum=0;
  5. for(int i=0;i