美团网产品类笔试面试经验(3)

笔试面试2018-11-22李一老师

  [cpp] view plaincopy

  /*----------------------------

  Copyright by yuucyf. 2015.08.16

  -----------------------------*/

  #include "stdafx.h"

  #include

  using namespace std;

  int JumpStep(int n)

  {

  if (n <= 0) return 0;

  if (n == 1 || n == 2) return n;

  return (JumpStep(n-1) + JumpStep(n-2));

  }

  int _tmain(int argc, _TCHAR* argv[])

  {

  int nStep = 0;

  cout << "请输入台阶数:";

  cin >> nStep;

  cout << "台阶数为" << nStep << ",那么总共有" << JumpStep(nStep) << "种跳法." << endl;

  return 0;

  }

  最后大题:

  设工厂甲和工厂乙次品率为1%和2%,现在从工厂甲和乙中分别占60%和40%的一批产品里随机抽取一件,发现是次品,求该次品是由工厂甲生产的概率?

  答:利用贝叶斯公式得P=(0.6*0.01)/(0.6*0.01+0.4*0.02)=3/7

阅读了本文,本站还为你提供以下可能你会感兴趣的相关文章:

KPMG上海暑期实习笔试经验

2015网易校招笔试经验

中国移动深圳分公司综合秘书岗笔试经验

相关推荐

猜你喜欢

大家正在看

换一换