目前本站已有 十几万 份求职资料啦!


百度技术研发笔试题目

10-16 00:00:09 来源:http://www.qz26.com 笔试题目   阅读:8692
导读: System.out.println(time); // 将时间归0,这样可以重新设置条件,再次得到全部走完所需要的时间. time = 0; }}/** * 这个函数的算法很乱,但暂时能解决问题 * * @param list */public static void dealEncounter(Ant[] antArray) { int num_ant = antArray.length; for (int j = 0; j < num_ant; j++) { for (int k = j + 1; k < num_ant; k++) { if (antArray[j].isEncounter(antArray[k])) { antArray[j].changeDistation(); antArray[k].changeDistation(); } } }}/** * 因为有5只Ant,所以组合之后有32种组合.刚好用5
百度技术研发笔试题目,标签:银行笔试题目,企业笔试题目,http://www.qz26.com
   System.out.println(time);

   // 将时间归0,这样可以重新设置条件,再次得到全部走完所需要的时间.
   time = 0;
  }

}

/**
  * 这个函数的算法很乱,但暂时能解决问题
  *
  * @param list
  */
public static void dealEncounter(Ant[] antArray) {

  int num_ant = antArray.length;
  for (int j = 0; j < num_ant; j++) {
   for (int k = j + 1; k < num_ant; k++) {
    if (antArray[j].isEncounter(antArray[k])) {
     antArray[j].changeDistation();
     antArray[k].changeDistation();
    }
   }
  }

}

/**
  * 因为有5只Ant,所以组合之后有32种组合.刚好用5位二进制来表示,如果为0则表示Ant往0的方向走 如果为1,则表示往27的方向走
  *
  * 注:在通过Ant的构造函数设置初始值时,通过过滤把0修改成了-1.
  */
public static int[] getDirections(int seed) {
  int result[] = new int[5];
  result[0] = seed % 2;
  result[1] = seed / 2 % 2;
  result[2] = seed / 4 % 2;
  result[3] = seed / 8 % 2;
  result[4] = seed / 16 % 2;

  System.out.println("directions is " + result[0] + "|" + result[1] + "|"
    + result[2] + "|" + result[3] + "|" + result[4]);

  return result;

} www.qz26.com

/**
  * 批量设置Ant的初始位置,这样设置不是十分必要,可以直接在代码中设置
  *
  * @return
  */
public static int[] getPoistions() {
  return new int[] { 3, 7, 11, 17, 23 };
}

/**
  * 取得设置好初始值的5只Ant
  *
  * @param positions
  * @param directions
  * @return
  */
public static Ant[] getAntList(int[] positions, int[] directions) {
  Ant ant3 = new Ant(positions[0], directions[0]);
  Ant ant7 = new Ant(positions[1], directions[1]);
  Ant ant11 = new Ant(positions[2], directions[2]);
  Ant ant17 = new Ant(positions[3], directions[3]);
  Ant ant23 = new Ant(positions[4], directions[4]);

  return new Ant[] { ant3, ant7, ant11, ant17, ant23 };
}

/**
  * 判断是否所有的Ant都已经走出了木杆,也就是设置退出条件
  *
  * @param antArray
  * @return
  */
public static boolean isAllOut(Ant[] antArray) {
  for (Ant ant : antArray) {
   if (ant.isOut() == false) {
    return false;
   }
  }
  return true;
}
}









编程:
用C语言实现一个revert函数,它的功能是将输入的字符串在原串上倒序后返回。
2 编程:
用C语言实现函数void * memmove(void *dest,const void *src,size_t n)。memmove
函数的功能是拷贝src所指的内存内容前n个字节
到dest所指的地址上。

3 英文拼写纠错:
在用户输入英文单词时,经常发生错误,我们需要对其进行纠错。假设已经有一个包
含了正确英文单词的词典,请你设计一个拼写纠错
的程序。

上一页  [1] [2] [3] [4]  下一页


Tag:笔试题目银行笔试题目,企业笔试题目求职笔试面试 - 笔试题目
【字号: 】 【打印】 【关闭
《百度技术研发笔试题目》相关文章
最新更新
推荐热门
联系我们 | 网站地图 | 财务资料 | 范文大全 | 求职简历 | 财会考试 | 成功励志
Copyright 二六求职资料网 All Right Reserved.
1 2 3 4 5 6 7 8 9 10