12
返回列表 发新帖
楼主: 匿名
跳转到指定楼层
上一主题 下一主题
收起左侧

狗家店面

地里匿名用户
🔗
匿名用户-6NJVE  2022-11-12 02:36:24
匿名用户 发表于 2022-11-10 14:03
請問是樓主是怎麼拿到面試的?是海投之後 HR reach out 問要不要面試?

內推的
方便的話請幫加米,謝謝
回复

使用道具 举报

🔗
ClearSight 2022-11-12 07:21:37 | 只看该作者
全局:
匿名用户 发表于 2022-11-11 12:36
backtracking也可以的 類似刷題word search那題
方便的話請幫加米,謝謝

很有用的信息!
已加米
回复

使用道具 举报

🔗
ChenXFRY 2022-11-16 07:57:08 | 只看该作者
全局:
本帖最后由 ChenXFRY 于 2022-11-15 15:58 编辑
  1. #include <iostream>
  2. #include <numeric>
  3. #include <vector>

  4. using namespace std;

  5. /*
  6.     double p = 0.9;                // caught when passing vertically to adjacent rows
  7.     double q = 0.2;                // caught when passing horizontally to adjacent cols
  8. */
  9. double caughtPossibility(vector<pair<int, int>> &students, double p, double q) {
  10.     // source: students[0]
  11.     // dest: students.back()
  12.    
  13.     // 1 - (not caught by teacher) * ... * (not caught by teacher)
  14.     // we find the product of posiblity of all edges, then 1-X is the answer
  15.     /*
  16.     int r = 1;
  17.     double pToNextCol = p * pow(0.5, r);
  18.     double pToNextRow = q * pow(0.5, r);
  19.     */
  20.     // move from [sr,sc] to [dr, dc]
  21.     auto probablityToMove = [&](pair<int, int>& from, pair<int, int>& to) {
  22.         auto [sr, sc] = from;
  23.         auto [dr, dc] = to;
  24.         
  25.         // not adjacent cells...
  26.         if (abs(dr - sr) > 1 && abs(dc - sc) > 1) {
  27.             return 0.0;
  28.         }
  29.         // same position, do not need calculate.
  30.         if (dr == sc && dc == sc) {
  31.             return 1.0;
  32.         }
  33.         
  34.         // move on the same colume
  35.         if (abs(dr - sr) == 1) {
  36.             return p * pow(0.5, dr > sr ? sr : dr);
  37.         }
  38.         // move on the same row
  39.         if (abs(dc - sc) == 1) {
  40.             return q * pow(0.5, sr);
  41.         }
  42.         
  43.         // not reachable
  44.         return 0.0;
  45.     };
  46.    
  47.     // given the path
  48.     double notByCaught = 1.0;
  49.     for (int i = 1; i < students.size(); i++) {
  50.         notByCaught *= 1 - probablityToMove(students[i - 1], students[i]);
  51.     }
  52.     return 1 - notByCaught;
  53. }


  54. int main(int argc, char *argv[]) {
  55.     double p = 0.5, q = 0.9;
  56.     vector<pair<int, int>> path = {
  57.         {0, 1},
  58.         {0, 2},
  59.         {0, 3}
  60.     };
  61.     cout << caughtPossibility(path, p, q);
  62. }
复制代码
回复

使用道具 举报

🔗
chaoye 2023-6-13 12:40:05 | 只看该作者
全局:
只求第一个到最后一个到概率吗?而且路径不一样概率也不一样,这个是随便选一个路径的意思吗?
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-D2XHF  2023-9-19 11:06:34
现在google还在招人吗?
回复

使用道具 举报

全局:
非常感谢分享,请问还有别的题目吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表