1. 编程题1

Little Hi is playing a video game. Each time he accomplishes a quest in the game, Little Hi has a chance to get a legendary item.At the beginning the probability is P%. Each time Little Hi accomplishes a quest without getting a legendary item, the probability will go up Q%. Since the probability is getting higher he will get a legendary item eventually.After getting a legendary item the probability will be reset to ?P/(2I)?% (?x? represents the largest integer no more than x) where I is the number of legendary items he already has. The probability will also go up Q% each time Little Hi accomplishes a quest until he gets another legendary item.Now Little Hi wants to know the expected number of quests he has to accomplish to get N legendary items.  Assume P = 50, Q = 75 and N = 2, as the below figure shows the expected number of quests is2*50%*25% + 3*50%*75%*100% + 3*50%*100%*25% + 4*50%*100%*75%*100% = 3.25legendary.png输入
The first line contains three integers P, Q and N.  1 ≤ N ≤ 106, 0 ≤ P ≤ 100, 1 ≤ Q ≤ 100输出
Output the expected number of quests rounded to 2 decimal places.样例输入
50 75 2
样例输出
3.25
EmacsNormalVim

2. 编程题2

“There is a tree of N nodes which are numbered from 1 to N. Unfortunately, its edges are missing so we don’t know how the nodes are connected. Instead we know:

  1. Which nodes are leaves

  2. The distance (number of edges) between any pair of leaves

  3. The depth of every node (the root’s depth is 1)

  4. For the nodes on the same level, their order from left to right

Can you restore the tree’s edges with these information? Note if node u is on the left of node v, u’s parent should not be on the right of v’s parent.

tree-restoration.png

输入
The first line contains three integers N, M and K. N is the number of nodes. M is the depth of the tree. K is the number of leaves.

The second line contains M integers A1, A2, … AM. Ai represents the number of nodes of depth i.

Then M lines follow. The ith of the M lines contains Ai numbers which are the nodes of depth i from left to right.

The (M+3)-th line contains K numbers L1, L2, … LK, indicating the leaves.

Then a K × K matrix D follows. Dij represents the distance between Li and Lj.

1 ≤ N ≤ 100

输出
For every node from 1 to N output its parent. Output 0 for the root’s parent.

样例输入
8 3 5
1 3 4
1
2 3 4
5 6 7 8
3 5 6 7 8
0 3 3 3 3
3 0 2 4 4
3 2 0 4 4
3 4 4 0 2
3 4 4 2 0
样例输出
0 1 1 1 2 2 4 4`

***3. 编程题3***```In a video game Little Hi is trapped in a maze. The maze can be considered as an N × M grid. There are monsters on some cells. Each cell has one monster at most. Below is an example of a 4x5 maze. '.' represents an empty cell. 'D' represents the entrance, Little Hi's starting point. 'M' represents a normal monster. 'S' represents a special monster.  ..S..
M...M
..D..
.M...
At the beginning, each cell is covered by a slate except that the slate on the entrance cell has been already removed. Each round Little Hi may either remove a slate as long as1. each monster has either been killed or still covered by a slate, and2. the cell covered by the slate is adjacent to some cell whose slate has been already removed. (Two cells are adjacent if they share a common side.)or attack a monster as long as the slate covering it has been removed.At the beginning Little Hi has Hp hit points and Ap attack points. Each monster also has its hit points Hi and attack points Ai. When Little Hi attacks a monster, the hit points of both sides should subtract the attack points of the other side.For example, if Little Hi's hit points are 50 and attack points are 30. When he attacks a monster whose hit points are 25 and attack points are 10, the remaining hit points for Little Hi are 40 and the remaining hit points for the monster are -5.When hit points are less than or equal to 0 the monster is killed.At the beginning Little Hi has a buff called "Destruction Blade" which lasts for 5 rounds. With such buff Little Hi does not take damage when he attacks a monster. The buff vanishes after 5 rounds but can be refreshed or regained for the following 5 rounds after killing a special monster. (Note that the buff always lasts for 5 rounds after killing a special monster no matter how many rounds left before killing the monster.)Now given the map of the maze. Can you tell whether Little Hi can kill all the monsters? If he can what is the maximum remaining hit points?输入
Line 1: two integers N and M. (2 ≤ N, M ≤ 6, N × M ≤ 20)Line 2 .. N+1: M characters per line, representing the maze map.Line N+2 .. N+K+1: two integers Hi and Ai per line, representing the hit points and attack points for each monster, from top to bottom and left to right. (3 ≤ K ≤ 7)Line N+K+2: two integers Hp and Ap, the hit points and attack points for Little Hi.输出
If Little Hi can kill all the monsters and stay alive output the maximum remaining hit points. Otherwise output DEAD.样例解释
Let's assume the upper left cell is (1, 1).Round 1: remove slate (2, 3), buff remains 4 roundsRound 2: remove slate (2, 2), buff remains 3 roundsRound 3: remove slate (2, 1), buff remains 2 roundsRound 4: attack monster (2, 1), take no damage, buff remains 1 roundRound 5: attack monster (2, 1), take no damage, monster killed, buff vanishesRound 6: remove slate (2, 4)  Round 7: remove slate (4, 3)  Round 8: remove slate (1, 3)  Round 9: attack monster (1, 3), take 5 damage, HP=55Round 10: attack monster (1, 3), take 5 damage, HP=50, monster killed, buff remains 5 roundsRound 11: remove slate (2, 5), buff remains 4 roundsRound 12: attack monster (2, 5) take no damage, buff remains 3 roundsRound 13: attack monster (2, 5) take no damage, buff remains 2 roundsRound 14: remove slate (4, 2), buff remains 1 roundRound 15: attack monster (4, 2), take no damage, buff vanishesRound 16: attack monster (4, 2), take 5 damage, HP=45, monster killed样例输入
4 5
..S..
M...M
..D..
.M...
20 5
20 5
20 5
20 5
60 10
样例输出
45<div class="se-preview-section-delimiter"></div>

4. 编程题4

这里写代码片
 ***4. 编程题4***

You are given a sequence S of parentheses. You are asked to insert into S as few parentheses as possible so that the resulting sequence T is well matched.

It’s not difficult. But can you tell how many different T you can get?

Assume S = ()), you can get either (()) or ()().

输入
One line contains the sequence S.

For 30% of the data, 1 ≤ |S| ≤ 10

For 60% of the data, 1 ≤ |S| ≤ 200

For 100% of the data, 1 ≤ |S| ≤ 1000

输出
Output 2 integers indicating the minimum number of parentheses need to be inserted into S and the number of different T. The number of different T may be very large, so output the answer modulo 109+7.

样例输入
())
样例输出
1 2
“`

微软亚洲研究院2017年笔试编程题相关推荐

  1. 微软亚洲研究院资深研究员梅涛:原来视频可以这么玩了! | CCF-GAIR 2017

    7月9日,由中国计算机学会(CCF)主办,雷锋网与香港中文大学(深圳)承办的CCF-GAIR 2017全球人工智能与机器人峰会进入了第三天.在CV+专场首场,微软亚洲研究院资深研究员梅涛博士为大会带来 ...

  2. 美团点评2017秋招笔试编程题

    美团点评2017秋招笔试编程题 1, 大富翁游戏,玩家根据骰子的点数决定走的步数,即骰子点数为1时可以走一步,点数为2时可以走两步,点数为n时可以走n步.求玩家走到第n步(n<=骰子最大点数且是 ...

  3. 国防科技大学计算机学院刘洋,GAMES Webinar 2017-02期(Siggraph 2017论文报告)| 刘洋(微软亚洲研究院),徐凯(国防科技大学)...

    [GAMES Webinar 2017-02期(Siggraph 2017论文报告)] 报告嘉宾1:刘洋,微软亚洲研究院 报告时间:2017年6月29日(星期四)晚20:00-20:45(北京时间) ...

  4. 微软亚洲研究院副院长刘铁岩:以计算之矛攻新冠之盾

    智源导读:新冠肆虐以来,全世界众多计算机科学家都在研究利用计算机模拟新冠传播,制定防控策略,其中SEIR模型作为常用的流行病预测模型,被广泛讨论.微软亚洲研究院副院长刘铁岩近期在北京智源大会上发表了题 ...

  5. 我的微软亚洲研究院实习生面试经历

    来到MSRA实习快2个月了,有很多收获,但总是懒得写,今天有点时间就先写一下我的面试过程,分享一点个人的经验,希望能对低年级的同学有点帮助.首先是投简历.想去MS或者IBM.GOOGLE实习,英文简历 ...

  6. 微软亚洲研究院的“三好”实习生

    在博客留言中,有读者反映想了解如何才能成为微软亚洲研究院实习生.为此,我们邀请了研究院创新工程中心的开发经理邹欣谈谈他在招收实习生过程中的体会.邹欣于1991年获得北京大学计算机软件学士学位,随后去美 ...

  7. [微软亚洲研究院]凌小宁教授给软件新人的演讲——选择的力量

    9月9日下午3点,凌小宁教授在复临舍报告厅07级新生做了题为"人生的选择是天使也是魔鬼"的主题演讲. 演讲中,凌教授向同学们讲解了成为软件业领军人物所应具备的五种能力,以及在学习与 ...

  8. 微软亚洲研究院论文解读:基于动态词表的对话生成研究(PPT+视频)

    本文为 12 月 27 日,北京航空航天大学博士生.微软亚洲研究院实习生--吴俣在第 21 期 PhD Talk 中的直播分享实录. 本次 Talk 的主题是基于动态词表的对话生成研究.首先,吴俣博士 ...

  9. 北京大学微软亚洲研究院人工智能与信息社会大纲(MOOC)-北大陈斌.md

    授课目标 本课程的目标,是为大学生和社会公众提供一个深入理解人工智能的入门基础,使学生初步了解人工智能技术的基本概念.发展历史.经典算法.应用领域和对人类社会的深远影响,从而打开学习人工智能的大门,为 ...

  10. 专访微软亚洲研究院首席研发经理邹欣:AI 时代程序员将往哪走?

    导读:6月21-23日,2019 GIAC全球互联网架构大会将于深圳举行.GIAC是面向架构师.技术负责人及高端技术从业人员的年度技术架构大会,是中国地区规模最大的技术会议之一.今年GIAC邀请到了众 ...

最新文章

  1. java基础之——类的初始化顺序(转载)
  2. [专栏目录]-Android专栏目录
  3. 手把手教你使用C#操作SQLite数据库,新建数据库,创建表,插入,查询,删除,运算符,like...
  4. matlab 滤波_MATLAB之简单卡尔曼滤波
  5. 下列哪项能正确遍历文件夹内所有文件?
  6. 如何确定python开发环境已经配置好_python学习第一天:window安装python开发环境完整篇...
  7. 一个sql生成hive日期维度表
  8. 使用XPathExpression类对XML文件进行排序
  9. 用c#算成绩的总和_用c#输入几门课程成绩求总成绩和平均成绩,定义方法实现如果输入的成绩不是整数,则重新输入(方法)...
  10. 如何CLASSPATH下的resource.properties文件进行读写操作?
  11. 动态规划-自底向上的 0-1 背包问题
  12. RHEL7平台下电信拨号上网配置
  13. codeforces 1562 A. The Miracle and the Sleeper
  14. Linux 之用户管理与文件权限
  15. 如何实现网页分享到微信,微博,空间
  16. 道阻且长 行者将至 ——新高考下的教学策略
  17. 修改IE设置(修改注册表)允许活动内容在我的电脑的文件运行
  18. mysql 1265警告
  19. Python 求交错序列前N项和
  20. Server Disconnect

热门文章

  1. iphone java模拟器_【Mac + Appium + Java1.8学习(三)】之IOS自动化环境安装配置以及简单测试用例编写(模拟器、真机)...
  2. java递归走迷宫游戏
  3. FreeMarker源码分析(八)
  4. CM311-1-CH(JL)-YST_905L3(B)-安卓9.0-原生设置-完美AI语音精简线刷固件包
  5. Odoo实施指南 连载三:成功案例
  6. ZJ-笔记本风扇异响
  7. 支付宝前端团队详解基于Node.jsWeb框架Chair
  8. 基于Spring Boot旅游打卡小程序系统的设计与实现【Java毕业设计·安装调试·代码讲解·文档报告】
  9. MATLAB学习笔记(二)——数据及其运算
  10. delphi mysql 删除_Delphi如何清空日志文件