2017微软校园招聘笔试题
来源:互联网 发布:美工专用笔记本 编辑:程序博客网 时间:2024/05/22 15:10
题目1 : Shortening Sequence
- 样例输入
71 1 2 3 4 4 5
- 样例输出
1
描述
There is an integer array A1, A2 ...AN. Each round you may choose two adjacent integers. If their sum is an odd number, the two adjacent integers can be deleted.
Can you work out the minimum length of the final array after elaborate deletions?
输入
The first line contains one integer N, indicating the length of the initial array.
The second line contains N integers, indicating A1, A2 ...AN.
For 30% of the data:1 ≤ N ≤ 10
For 60% of the data:1 ≤ N ≤ 1000
For 100% of the data:1 ≤ N ≤ 1000000, 0 ≤ Ai ≤ 1000000000
输出
One line with an integer indicating the minimum length of the final array.
样例提示
(1,2) (3,4) (4,5) are deleted.
题目2 : Composition
- 样例输入
5abcde3acabde
- 样例输出
2
描述
Alice writes an English composition with a length of N characters. However, her teacher requires that M illegal pairs of characters cannot be adjacent, and if 'ab' cannot be adjacent, 'ba' cannot be adjacent either.
In order to meet the requirements, Alice needs to delete some characters.
Please work out the minimum number of characters that need to be deleted.
输入
The first line contains the length of the composition N.
The second line contains N characters, which make up the composition. Each character belongs to 'a'..'z'.
The third line contains the number of illegal pairs M.
Each of the next M lines contains two characters ch1 and ch2,which cannot be adjacent.
For 20% of the data: 1 ≤ N ≤ 10
For 50% of the data: 1 ≤ N ≤ 1000
For 100% of the data: 1 ≤ N ≤ 100000, M ≤ 200.
输出
One line with an integer indicating the minimum number of characters that need to be deleted.
样例提示
Delete 'a' and 'd'.
题目3 : Registration Day
- 样例输入
2 2 100 1600012345 500 2 1 500 2 500 1600054321 1100 1 2 300
- 样例输出
1700 2000
描述
It's H University's Registration Day for new students. There are M offices in H University, numbered from 1 to M. Students need to visit some of them in a certain order to finish their registration procedures. The offices are in different places. So it takes K units of time to move from one office to another.
There is only one teacher in each office. It takes him/her some time to finish one student's procedure. For different students this time may vary. At the same time the teacher can only serve one student so some students may need to wait outside until the teacher is available. Students who arrived at the office earlier will be served earlier. If multiple students arrived at the same time they will be served in ascending order by student number.
N new students need to finish his/her registration. They are numbered from 1 to N. The ith student's student number is Si. He will be arrived at H University's gate at time Ti. He needs to visit Pi offices in sequence which are Oi,1, Oi,2, ... Oi,Pi. It takes him Wi,1, Wi,2, ... Wi,Pi units of time to finish the procedure in respective offices. It also takes him K units of time to move from the gate to the first office.
For each student can you tell when his registration will be finished?
输入
The first line contains 3 integers, N, M and K. (1 <= N <= 10000, 1 <= M <= 100, 1 <= K <= 1000)
The following N lines each describe a student.
For each line the first three integers are Si, Ti and Pi. Then following Pi pairs of integers: Oi,1, Wi,1, Oi,2, Wi,2, ... Oi,Pi, Wi,Pi.(1 <= Si <= 2000000000, 1 <= Ti <= 10000, 1 <= Pi <= M, 1 <= Oi,j <= M, 1 <= Wi,j <= 1000)
输出
For each student output the time when he finished the registration.
样例提示
Student 1600012345 will be arrived at the gate at time 500. He needs to first visit Office #1 and then Office #2. He will be arrived at office #1 at time 600. He will leave office #1 at time 1100. Then He will arrive at office #2 at 1200. At the same time another student arrives at the same office too. His student number is smaller so he will be served first. He leaves Office #2 at 1700. End of registration.
Student 1600054321 will be arrived at the gate at time 1100. He will be arrived at Office #2 at 1200. Another student with smaller student number will be served first so he waits for his turn until 1700. He leaves Office #2 at 2000. End of registration.
题目4 : MS Recognition
- 样例输入
50 50..............................................................................................................................................#...................................###..........##..............##..................##.##........#................##..................#...........##...............###.......#..........#...........##...............####.....###.........###..........######..........#.##.....###..........####..............#.........#.##....####............##..............#........##..#...##.#..........#...#.............##........##..#..##.##..........#####...........##..........#...#.##..##......................................#...###...#.......................................#...###...#...........................................##...##......................##........................##.....##..............###..............................###............###...............................###.............##...............................###.............##...............................###..............##..............................###......###.......########......................###.....#####........########....................###...########...............##..................###..#####..##................##.................########....###................##................#######......##.....##.........###.................###.........##....###.......####.............................###...###.......###...............#...............##...###........................####.............###..###.......................######.............##..###.......................####................######........................###................######........................###.................#####.......##................###................#####........######............###.................###.........##########.........##########.......................##...####........############......................##................###########......................###.......................##.......................###......................###.......................###.....................###...................#######.....................##................########.......................###................####.........................####..................######...................######......................######................###.............................##.............................................................................................................
- 样例输出
3 4
描述
Given an image containing only two kinds of capital letters, 'M' and 'S', can you tell how many of each letter are there in the image? Note that the letters may be of different sizes and may be rotated.
输入
The first line contains two integers H and W, indicating the height and weight of the image. (1 <= H, W <= 500)
Then follows an H x W matrix indicating the image.
'.' indicates the pixel is empty and '#' indicates the pixel is part of a letter.
It is guaranteed that:
1. The letters are actually in Microsoft Yahei font.
2. Each letter consists of at least 20 pixels.
3. Different letters are at least 2 pixels away from each other.
输出
Two integers, the number of 'M' letters and the number of 'S' letters.
- 2017微软校园招聘笔试题
- 微软校园招聘笔试题
- 微软校园招聘笔试题
- 微软校园招聘笔试题
- 微软校园招聘笔试题
- 2017微软秋季校园招聘在线编程笔试(第二题)
- 2017微软秋季校园招聘在线编程笔试(第三题)
- 2013年微软校园招聘笔试题
- 2013年微软校园招聘笔试题
- 微软2013校园招聘笔试题
- 2013年微软校园招聘笔试题
- 微软2013校园招聘笔试题
- 微软2014校园招聘笔试题
- 微软2014校园招聘笔试题
- 微软2014校园招聘笔试编程题
- 微软2013校园招聘笔试题(9.22 第一次笔试)
- 微软2013校园招聘笔试题(9.22 第一次笔试)
- 微软2013校园招聘笔试题(9.22 第一次笔试)
- Discoverer
- spring-boot集成EasyUI和KindEditor
- poj3621 二分+spfa
- spring-boot集成Quartz
- 根据字段名称查询数据库表名
- 2017微软校园招聘笔试题
- 聚焦和增强卷积神经网络
- Linux Nginx 配置 PHP CI 框架 vhost 文件
- PendingIntent
- UVA 11300 Spreading the Wealth 中位数 *
- C++中静态变量static使用说明
- JavaWEB学习记录--HtmlUnit爬网页数据
- 【数据结构】算法9.1 顺序表查找-顺序查找
- 1059. C语言竞赛(20)