微软的考试题1

微软的100道算法面试题(一) 程序员为什么要学数据结构? 在计算机发展的初期,人们使用计算机的主要目的是处理数值计算问题。使用计算机解决具体问题一般需要经过以下几个步骤:首先从具体问题抽象出适当的数学模型,然后设计或选择解此数学模型的算法,接着编写程序并进行调试、测试,直至得到最终的解答。 由于最初涉及的运算对象是简单的整型、实型或布尔型数据,所以程序设计者的主要精力集中于程序设计的技巧上,而无需重视数据结构。随着计算... 阅读详情

第一题:Shortening Sequence

时间限制:10000ms
单点时限:1000ms
内存限制:256MB
描述
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.


样例输入
7
1 1 2 3 4 4 5
样例输出
1

思路:单链表的插入删除,我的代码写的不好

#include<stdio.h>

#include<stdlib.h>
typedef struct _node
{
    int data;
    struct _node *next;

}node;


unsigned int getresult(node * head, unsigned int n)
{
    unsigned int num1 = n;
    unsigned int num2 = n;
    
    do
    {
        num1 = num2;
        node *p = head;
        node * pre = head;
        while(p != NULL&&p->next != NULL)
        {
            int sum = (p->data) + (p->next->data);
            if( sum%2 == 1)
            {
                if(p->next->next != NULL){
                    if(p  == head)
                    {
                        head = p->next->next;
                        free(p->next);
                        free(p);
                        p = head;
                        pre = head;
                    }else{
                        pre->next = p->next->next;
                        free(p->next);
                        free(p);
                        p = pre->next;
                    }
                }
                else {
                    pre->next = NULL;
                    free(p->next);
                    free(p);
                    p =NULL;
                }
                num2-=2;
            }else
            {
                pre = p;
                p = p->next;
            }
        }
    }
    while(num1 != num2);
    return num2;
}


node * CreateList(node*head, unsigned len)
{
    unsigned int i;
    node *p = NULL;
    for(i = 0;i<len;i++)
    {
        int data;
        scanf("%d",&data);
        if(i == 0)
        {
            head = (node*)malloc(sizeof(node));
            head->data = data;
            p = head;   
        }
        else
        {
            p->next  = (node*)malloc(sizeof(node));
            p =  p->next; 
            p->data = data;
            p->next = NULL;
        }
    }
    return head;

}


void FreeList(node *head, unsigned int result)
{
    node *p = NULL;
    unsigned int  j;
    for(j = 0;j<result;j++)
    {
        p = head->next;
        free(head);
        head = p;
    }
}


int main()
{
    unsigned int  len;
    scanf("%u",&len);
    node *head = NULL;
    head = CreateList(head, len);
    unsigned int result = getresult(head, len);
    printf("%u\n",result);
    FreeList(head, result);
}


第二题:Composition

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'.


样例输入
5
abcde
3
ac
ab
de
样例输出
2

第三题Registration Day

 描述
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.

样例输入
2 2 100  
1600012345 500 2 1 500 2 500  
1600054321 1100 1 2 300
样例输出
1700  
2000

第四题MS Recognition

描述
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.

样例输入
50 50
..................................................
..................................................
..........................................#.......
............................###..........##.......
.......##..................##.##........#.........
.......##..................#...........##.........
......###.......#..........#...........##.........
......####.....###.........###..........######....
......#.##.....###..........####..............#...
......#.##....####............##..............#...
.....##..#...##.#..........#...#.............##...
.....##..#..##.##..........#####...........##.....
.....#...#.##..##.................................
.....#...###...#..................................
.....#...###...#..................................
.........##...##......................##..........
..............##.....##..............###..........
....................###............###............
...................###.............##.............
..................###.............##..............
.................###..............##..............
................###......###.......########.......
...............###.....#####........########......
..............###...########...............##.....
.............###..#####..##................##.....
............########....###................##.....
...........#######......##.....##.........###.....
............###.........##....###.......####......
.......................###...###.......###........
.......#...............##...###...................
.....####.............###..###....................
...######.............##..###.....................
..####................######......................
..###................######.......................
.###.................#####.......##...............
.###................#####........######...........
.###.................###.........##########.......
..##########.......................##...####......
..############......................##............
....###########......................###..........
.............##.......................###.........
.............###.......................###........
.............###...................#######........
.............##................########...........
............###................####...............
..........####..................######............
.......######......................######.........
.......###.............................##.........
..................................................
..................................................
样例输出
3 4


通过PL-100微软认证的一些经验 一月份进入了新部门, 阅读详情

相关推荐

1、微软 Windows Server 2003 认证备考全攻略

本文全面解析了微软 Windows Server 2003 认证的备考策略,涵盖MCSA与MCSE等认证类型的考试要求、职业发展路径、考试题型及应对策略。详细介绍了电子书籍使用方法、备考资源利用、硬件软件配置建议、时间规划、网络学习途径以及考试心态调整技巧。通过系统化的学习方法和丰富的实践练习,帮助考生高效准备并顺利通过认证考试,提升IT职业技能与职场竞争力。

food6的博客 63

微软笔试题(附答案)

1.烧一根不均匀的绳,从头烧到尾总共需要1个小时。现在有若干条材质相同的绳子,问如 何用烧绳的方法来计时一个小时十五分钟呢? 2.你有一桶果冻,其中有黄色、绿色、红色三种,闭上眼睛抓取同种颜色的两个。抓取多 少个就可以确定你肯定有两个同一颜色的果冻? 3.如果你有无穷多的水,一个3公升的提捅,一个5公升的提捅,两只提捅形状上下都不均 匀,问你如何才能准确称出4公升的水? 4.一个岔...

omygege 5363

2、微软认证考试全解析:从要求到备考策略

本文全面解析了微软认证专家(MCSE)考试的要求、备考策略以及SQL Server 2000企业版的考试内容。从考试类型到题型变化,从考试开发流程到学习方法和资源推荐,涵盖了通过MCSE认证所需的全方位信息。此外,还提供了评估测试示例及答案解析,帮助考生深入理解考试重点,制定高效备考计划,提升技术能力与应试技巧。

resnet7explorer的博客 248

微软经典面试测试题和参考答案(变态)

 第一组 1.烧一根不均匀的绳,从头烧到尾总共需要1个小时。现在有若干条材质相同的绳子,问如何用烧绳的方法来计时一个小时十五分钟呢?2.你有一桶果冻,其中有黄色、绿色、红色三种,闭上眼睛抓取同种颜色的两个。抓取多少个就可以确定你肯定有两个同一颜色的果冻?3.如果你有无穷多的水,一个3公升的提捅,一个5公升的提捅,两只提捅形状上下都不均匀,问你如何才能准确称出4公升的水?4.一个岔路口分

TOMB RAIDER 4438

C#期末考试题及解析全集

函数是编程中最基本的构建模块之一,它们允许我们将代码封装在可重用的单元中。在C#中,函数通常被称为方法,是类或对象行为的实现。本章将深入探讨函数的声明、实现、方法重载、可变参数以及高级函数特性,为开发人员提供更加深入的理解和实践指导。在C#中,类是创建对象的蓝图,它定义了对象的状态和行为。类成员可以是字段、属性、方法、事件等,而访问修饰符(Access Modifiers)用于控制这些成员的可访问性。C#提供了一些访问修饰符,主要有:public: 成员可以被任何其他代码访问。private。

weixin_42163404的博客 1179

深入解析NPN与PNP传感器驱动电路的设计逻辑与实战应用

本文深入解析NPN与PNP传感器驱动电路的设计逻辑与实战应用,详细对比两者的电流路径差异和电平变化特性。通过实际案例分享电路设计要点,包括上拉电阻选择、保护二极管配置等,并提供工业应用中的选型策略和常见故障排查指南,帮助工程师优化传感器系统集成。

weixin_42561476的博客 472

C# - 2017微软校园招聘笔试题 之 MS Recognition[待解决]

MS Recognition 在线提交: hihoCoder 1402 http://hihocoder.com/problemset/problem/1402 类似: OpenJudge - I:PKU Zealots http://poj.openjudge.cn/campus2016/I/ 描述 Given an image containing only two kin...

极客学长Bravo | 突破信息差 | 副业生财有术 1327

手把手教你配置MCAL中的CAN模块:从基础参数到实战避坑指南

本文提供了一份详尽的MCAL CAN模块配置指南,涵盖从基础参数设置到实战避坑的全过程。文章深入解析了CAN控制器核心参数、硬件对象配置、数据流处理及常见问题排查,并结合源码分析,帮助嵌入式开发者构建稳定高效的CAN通信链路,是汽车电子领域通信开发的实用参考。

weixin_29165465的博客 337

如何报考微软认证

微软认证考试时间不同于国内的考试,是随报随考,考试的时间都由考生在携带身份证和考试费报名时自己决定的,只要考试中心正常营业,考生就可以正常报考!IT认证考试资源网建议考生第一天报名预约,第三天参加考试!

qq_34589842的博客 5261

PaddleOCR实战:从零开始训练自己的OCR模型(附完整代码与数据集处理技巧)

本文提供了一份详尽的PaddleOCR实战指南,手把手教你从零开始训练专属的OCR模型。内容涵盖高质量训练数据的准备与标注技巧、预训练模型的选型对比、关键参数调优策略,并附有完整的代码示例。通过遵循本文的步骤,开发者可以高效构建并优化贴合自身业务场景的高精度OCR模型,实现从数据到部署的全流程掌握。

weixin_29263201的博客 571

【DexGraspNet与多指手抓取算法详解】第三章 DexGraspNet数据集构建机理

抓取姿态描述多指手与物体的相对空间关系,包含手掌位姿与手指关节配置。

VectorShift的博客 498

终于有人把【微软MOS认证】说清楚了

4、复习备考(方法):首先,先学视频,将视频中功能练熟,题目看懂,然后,考试的答题时间是 50 分钟做 35 个小任务,日常练习平均一题保证在 1 分 30 秒内完成;微软MOS认证的考试方式采用线上考试,没有专门的考试软件,而是采用远程控制考试中心电脑考试的方式!纸质证书:通过所有科目考试后,在通过考试后在考试群登记相关信息,纸质证书邮寄周期为一个月左右!报英文的下载英文的配套资料,报中文的下载中文的配套资料。📍仔细观看教学视频中关于考试界面的介绍,以及群文件里的考试必看文件。③考试证书等级:考助理级?

2501_90496024的博客 3160

镜头调焦的 调整的是焦距还是像距?

在镜头 “调焦”(即日常拍照时的)中,调整的核心是,而非焦距。

AIoT深度探索者 | 嵌入式系统架构师 深耕物联网(IoT)与人工智能(AI)融合技术,聚焦​​边缘计算、图像开发、低功耗通信协议​​,致力于智能硬件,关注我获取最新技术文章信息与海量资源~ 1352

在微型计算机中执行一个程序时加载顺序为,2018计算机基础自考试题(1)

2018计算机基础自考试题及答案(1)2018计算机基础自考试题及答案(1),本套试卷是2018计算机基础自考试题,有答案。一、单选题1.下列哪一项控制端到端传送的信息量并保证TCP的可靠性()。A.广播B.窗口C.错误恢复D.流量控制2.Word 中根据文本框中的文字排列方式,文本框可分为A.横排和竖排B.正排和反排C.横排和正排D.竖排和反排3.请问当目的地址为138.146.63.127...

weixin_36296444的博客 1071

国科大人工智能原理与算法-2024-第一次作业-雷震老师

1. 反射行动(比如从热炉子上缩回你的手)是理性的吗?它们是智能的吗? 2. 以下的计算机系统在何种程度上是人工智能的实例: - 超市条码扫描器 - 网络搜索引擎 - 语音激活的电话菜单 - 对网络状态动态响应的网络路由算法 3. 为什么进化会倾向于导致行为合理的系统?设计这样的系统想达到的目标是什么?

MatsumotoChrikk 2930

CesiumJS【Basic】- #002 加载在线瓦片地图数据

cesiumjs 加载各类在线地图数据

AlanL的专栏 952

把微软MOS认证了解清楚再去考也不迟!

打算考微软MOS认证的宝子们,建议先把这些关键信息弄明白,再开始备考会更高效,少走弯路~

2501_90496024的博客 1105

GEE:基于MODIS数据计算NDVI时间序列,并使用Savatsky-Golay(SG)滤波器对其进行平滑处理

优快云@_养乐多_本文将介绍如何在 Google Earth Engine (GEE) 平台中,使用 MODIS 数据计算 NDVI 时间序列,并对该数据集应用 Savitzky-Golay 滤波器,得到了一个新的平滑后的数据集。Savitzky-Golay 滤波器可以有效地去除信号中的噪声,并平滑信号的变化。该方法可以扩展到基于 MODIS 数据计算的任何指数或者波段。

养乐多的博客 1426

2016计算机应用考试题,2016年计算机一级应用考试题

2016年计算机一级应用考试题 (18页) 本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找使用更方便哦!11.90 积分2016年计算机一级应用考试题  为了帮助同学们更好备考计算机一级考试题,小编为大家整理了以下模拟试题,希望能为同学们的备考提供帮助!  一、单项选择题  1.第一代电子计算机采用的主机电器元件为 。  A.中小规模集成电路 B.晶体管  C.电子管 ...

weixin_36035900的博客 288

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

C#考试题

1、在C#中,string str = null 与 string str = “” 请尽量使用文字或图象说明其中的区别。 回答要点:说明详细的空间分配。(10分) 答:string str = null 是不给他分配内存空间,而string str = "" 给它分配长度为空字符串的内存空间. 2、请详述在dotnet中类(class)与结构(struct)的异同:(10分) 答

猫老大专栏 2369

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

.net考试题

在网上找来的,希望对大家有所帮助。1 (1)面向对象的语言具有__继承性_性、_封装性_性、_多态性 性。(2)能用foreach遍历访问的对象需要实现 _ IEnumerable 接口或声明_ GetEnumerator 方法的类型。1.c#中的三元运算符是__?:__2.当整数a赋值给一个object对象时,整数a将会被__装箱___?3.类成员有__3__种可访问形式?4.public st

mengfei2656的专栏 6149

微软仅用提示词就让ChatGPT达到专业医师水平

在MedQA数据集(美国医师执照考试题)上,通过Medprompt提示,GPT-4的准确率首次超过90%,超越了BioGPT和Med-PaLM等微调方法。研究人员还讨论了Medprompt策略在“Eyes-Off”数据上的表现,即在训练或优化过程中模型未曾见过的数据上的表现,用于检验模型是否过拟合训练数据。最后,研究人员还探索了Medprompt的跨领域泛化能力,在包括电气工程、机器学习、哲学、专业会计、专业法律和专业心理学等领域的数据集上进行了测试。其中,自动生成思维链步骤对性能提升的贡献最大。

ooope的博客 652

**Microsoft Certified Professional(MCP)** 认证考试

MCP(Microsoft Certified Professional)是微软认证体系中的一项入门级认证,旨在验证考生在微软产品和技术(如 Windows Server、Azure、SQL Server、Microsoft 365)方面的技能。

lssffy的博客 2229

微软MOS避坑攻略❗ 说一些别人不敢说的话

微软MOS认证过程中,这些常见“坑⭕”建议尽量避开:

2501_90496024的博客 440

CCNA官方章节考试题之《应用层功能及协议》

 CCNA官方章节考试题之《应用层功能及协议》   1窗体顶端哪个应用层协议中规定了 Microsoft 网络中用于文件共享的服务?DHCPDNS

liuqichao5540875的专栏 1208
上一篇: 最长无重复字符的子串
下一篇: 10进制转化为-2进制
lin_FS
博客等级 码龄15年 92粉丝 60原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值