2017微软秋季校园招聘在线编程笔试

【PBAP】规范精讲[3]: 蓝牙PBAP协议应用层核心——电话本数据的格式与交互逻辑解析 PBAP协议应用层是蓝牙电话本数据交互的核心,定义了电话本存储、对象类型、数据格式与虚拟目录结构。通过vCard标准格式及四大扩展属性(如X-IRMC-CALL-DATETIME、X-BT-UID),实现跨设备数据统一解析;采用多仓库与七类对象分类,支持本地与SIM卡双存储;虚拟文件夹结构结合句柄与vCard-listing索引,兼顾批量下载与精准访问;其标准化与实用性并重的设计,保障了车载、穿戴等场景下电话本数据的高效、稳定交互。 阅读详情

题目1 : 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<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>

#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define MID(x,y) ((x+y)>>1)

#define eps 1e-8
typedef long long  ll;
using namespace std;
#define N 1000005

stack<int>s;
int a[N];
int n;

int main()
{
    int i,j;
    while(cin>>n)
    {
       for(int i=0;i<n;i++)
         scanf("%d",&a[i]);
       while(!s.empty()) s.pop();
       for(int i=0;i<n;i++)
       {
           if(s.empty())
           {
               s.push(a[i]);
               continue;
           }
           int temp=s.top();
           if((temp+a[i])%2)

            {
                s.pop();
                continue;
            }
            s.push(a[i]);
       }
       cout<<s.size()<<endl;
    }
    return 0;
}




题目2 : Composition

时间限制:10000ms
单点时限:1000ms
内存限制:256MB

描述

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
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>

#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define MID(x,y) ((x+y)>>1)

#define eps 1e-8
typedef long long  ll;
using namespace std;
#define N 100005

int dp[N][27];
int a[27][27];
int n,m;
char c[N];
char dd[3];

void solve()
{
    memset(dp,0,sizeof(dp));
    for(int i=0;i<n;i++)
    {
       int temp=c[i]-'a';
       if(i>0) for(int j=0;j<26;j++) dp[i][j]=dp[i-1][j];
       dp[i][temp]=max(dp[i][temp],1);
       if(i==0) continue;
       for(int j=0;j<26;j++)
         if(!a[temp][j]&&!a[j][temp]) dp[i][temp]=max(dp[i][temp],dp[i-1][j]+1);
    }
    int ans=0;
    for(int i=0;i<n;i++)
        for(int j=0;j<26;j++)
         if(dp[i][j]>ans) ans=dp[i][j];
    cout<<n-ans<<endl;
}

int main()
{
    int i,j;
    while(~scanf("%d",&n))
    {
        scanf("%s",c);
        scanf("%d",&m);
        memset(a,0,sizeof(a));
        while(m--)
        {
           scanf("%s",dd);
           a[dd[0]-'a'][dd[1]-'a']=1;
           a[dd[1]-'a'][dd[0]-'a']=1;
        }
        solve();
    }
    return 0;
}



题目3 : Registration Day

时间限制:10000ms
单点时限:1000ms
内存限制:256MB

描述

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 bystudent 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
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>

#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define MID(x,y) ((x+y)>>1)

#define eps 1e-8
typedef long long  ll;
using namespace std;
#define N 10005
map<int,int>mp;
int n,m,k;
int student[N];
int arrive[N];
int num[N];
int last[N];
struct office{
   office(int p,int c):pos(p),cost(c){}
   int pos;
   int cost;
};
int ans[N];
vector<office>g[N];

struct A{
    A(int _id,int real,int _Ti,int _p):id(_id),Ti(_Ti),p(_p),real_id(real){}
    int id;
    int Ti;
    int p;
    int real_id;
    bool operator<(const A & b)const
    {
        if(Ti!=b.Ti) return Ti>b.Ti;
        return id>b.id;
    }
};

priority_queue<A>q;

void bfs()
{
   int i,j;
   while(!q.empty())q.pop();
   memset(ans,0,sizeof(ans));
   memset(last,0,sizeof(last));
   for(int i=0;i<n;i++)
      q.push(A(student[i],i,arrive[i]+k,0));
   A cur(1,1,1,1);
   while(!q.empty())
   {
       cur=q.top();
       q.pop();
       int pp=cur.real_id;//真正的id
       int vis_office=g[pp][cur.p].pos; //访问的office
       if(cur.Ti<last[vis_office])cur.Ti=last[vis_office];
       if(cur.p==g[pp].size()-1)
       {
           ans[pp]=cur.Ti+g[pp][cur.p].cost;
           last[vis_office]=ans[pp];
           continue;
       }
       last[vis_office]=cur.Ti+g[pp][cur.p].cost;
       cur.Ti=cur.Ti+k+g[pp][cur.p].cost;
       cur.p+=1;
       q.push(cur);
   }
}

int main()
{
    int i,j;
    int x,y;
    while(~scanf("%d%d%d",&n,&m,&k))
    {
        mp.clear();
        for(int i=0;i<=n;i++) g[i].clear();
        for(int i=0;i<n;i++)
        {
             scanf("%d%d",&student[i],&arrive[i]);
             scanf("%d",&num[i]);
             for(int j=0;j<num[i];j++)
             {
                  scanf("%d%d",&x,&y);
                  g[i].push_back(office(x,y));
             }
        }
        bfs();
        for(int i=0;i<n;i++)
            printf("%d\n",ans[i]);
    }
    return 0;
}






【HID】规范精讲[4]: 蓝牙HID传输机制——无线数据的传递规则与底层逻辑 蓝牙HID传输机制深度解析 蓝牙HID协议通过双信道架构实现高效数据传输。控制信道采用同步请求-响应模式,确保配置指令和状态查询的可靠性;中断信道采用异步无确认模式,实现鼠标移动、键盘按键等实时操作的极低延迟传输。两种信道分工明确:控制信道处理特征报告等可靠性要求高的数据,中断信道处理输入/输出报告等实时性要求高的数据。协议严格规定了报告长度校验、MTU约束和传输优先级等规则,既保证了不同类型数据的传输质量,又确保了设备间的兼容性。这种机制让无线外设获得了接近有线的使用体验。 阅读详情

相关推荐

LE Audio ASE状态机深度解析[2]:Codec Configured 流程分析

本文深入解析了Android蓝牙LEAudio模块中AseStateMachineProcessCodecConfigured核心函数的实现逻辑,该函数负责处理ASE(音频流端点)的CodecConfigured状态转换。文章详细阐述了参数解析、QoS校验、组状态管理、CIG创建等关键环节,揭示了LEAudio流配置的核心机制。

byte轻骑兵的技术小窝 2万+

【TextIn大模型加速器 + 火山引擎】在Coze平台快速搭建智能文档解析与合规审查Agent

本文介绍如何结合TextIn文档解析引擎与火山引擎Coze/HiAgent平台构建智能文档处理系统。重点演示了"跨国采购合同审查Agent"的实现过程,包括文档解析、条款分割、模板比对和大模型分析的工作流配置。该系统支持50+语言、20+格式文档处理,通过低代码方式实现从解析到智能理解的自动化流程,显著提升处理效率(耗时从3小时降至3分钟)和准确率(漏审率降低78%)。该方案为企业文档智能处理提供了高效的一体化解决方案,可扩展应用于产品手册翻译、贸易单据核验等多种场景。

byte轻骑兵的技术小窝 2万+

【Bluedroid】蓝牙 GATT 客户端应用注销核心流程剖析(3)

本文深入剖析Android Bluedroid蓝牙协议栈中GATT客户端注销的核心流程。通过源码分析,揭示了从bta_gattc_deregister_cmpl入口函数到GATT_Deregister完成服务停止、链路状态更新、资源释放等关键操作的全过程。重点阐述了连接管理器如何联动清理后台连接,以及通过回调完成上层状态同步的机制。

byte轻骑兵的技术小窝 2万+

2017微软秋季校园招聘在线编程笔试 Composition

题目链接:http://hihocoder.com/contest/mstest2016oct/problem/2 题意:给我们一些约束相邻的条件,让我们判断最少去掉多少个字符达到这个状态。 解题思路,因为都是小写字母,我们完全可以根据每个字母的约束条件,找到条件下的最长子串,答案就是长度减去这个最长子串的长度。 复杂度:26*n #include #include #incl

RaAlGhul的博客 2777

Pytorch的一小步,昇腾芯片的一大步

相信在AI圈的人多多少少都看到了最近的信息:PyTorch最新2.1版本宣布支持华为昇腾芯片!

机器学习-深度学习-图像处理-opencv-段子 5240

Quartus II设计程序计数器PC、由PC产生ROM的地址(含仿真)

设计程序计数器PC,正常工作模式下,系统启动,设置PC的初始值,之后每来一个clk,PC的输出值应该增加1;当程序发生跳转时,PC的值应该发生改变,级将跳转的地址值赋进行输出。PC后端连接一个ROM,由PC来产生ROM的地址,仿真进行验证。

m0_73700621的博客 1815

2017微软秋季校园招聘在线编程笔试-#1399 : Shortening Sequence

http://hihocoder.com/problemset/problem/1399 题意理解:就是奇偶相碰会消失,最后剩多少个 急转弯:其实只要有奇数和偶数存在,都会想消,所以最后剩的就是多的那个。 算法:无。 数据结构:无。 from __future__ import print_function # # 'easy' __author__ = 'h

ruclion的专栏 629

Power BI常见问题篇1:无法打开文档

Power BI常见问题篇1:无法打开文档

weixin_48273257的博客 3304

2017微软秋季校园招聘在线编程笔试-#1401 : Registration Day

http://hihocoder.com/problemset/problem/1401 题意理解:每个人进队离队100次,10000个人,所以用优先队列1e6的nlogn应该可以,而将班级混起来,按照时间t排序就是对的。 急转弯:使用优先队列,班级混起来,用时间t和sno排序来做就是对的:同一个课堂的顺序一定对,而不同课堂,若排队的再其他课堂没排队的前面,那么当前排队的优先级一定

ruclion的专栏 436

Ai数字人直播系统搭建,本地源码部署,源码交付--支持OEM系统贴牌

AI 数字人直播系统是利用人工智能技术创建虚拟主播,并通过数字化技术实现直播互动的系统1。以下是其相关介绍:Ai数字人直播系统搭建,本地源码部署,源码交付--支持OEM系统贴牌。

weixin_ggwwsscc的博客 620

无感健康监测的未来:毫米波雷达如何重新定义睡眠科技与居家养老

毫米波雷达技术正重新定义无感健康监测,特别是在睡眠科技与居家养老领域。通过精准监测呼吸、心率和体动,无需穿戴设备即可实现临床级精度。结合合宙Air700E开发板,构建了完整的远程看护解决方案,为老年人提供跌倒检测、异常报警等安全保障,同时保护用户隐私。

cake8的博客 567

2017微软秋季校园招聘在线编程笔试-#1400 : Composition

http://hihocoder.com/problemset/problem/1400 题意理解:有限制的两个不能相邻,i之和前面剩下的那一个相关,所以可以f【i】【ch】的动态规划去做,每次转移考虑删不删i的字符 急转弯:想到i只和前面一个相关,并且可以记录下来。 算法:无 数据结构:无 # # 'f' __author__ = 'hjkrucli

ruclion的专栏 2735

仪表数字图像识别的传统方法

虽然现有很多机器学习算法能够准确地识别数字,但是传统方法对于一些需要离线识别且计算能力有限的下位机设备来说,仍然有非常不错的效果。因此,今天就向大家讲解一下传统的数字识别方法在仪表读数方面的应用。 1.图像预处理技术 1.1 主要流程 图像处理依次需要进行图片预处理、字轮区域定位、字符分割和字符识别等过程。其中图像处理流程如下图所示。 2. 详细过程 2.1 灰度化 为了减小图像原始数据量,本系...

XYZ 4523

2017微软秋季校园招聘在线编程笔试 题目2 Composition

http://hihocoder.com/contest/mstest2016oct/problem/2 一开始N*N一直超时,觉得不应该,然后java换成C++写了一下,还是TLE。各种地方改了一下,时间花了很多但依然还是大写的TLE。 后来想了一下,改成26*N总该可以了吧,然后ac了 题目2 : Composition 时间限制:10000ms 单点时限

hqw11的博客 1132

基于STM32、HAL库的ZMOD4510AI4R气体传感器驱动程序设计

ZMOD4510AI4R是Renesas公司推出的一款数字空气质量传感器,主要用于检测臭氧(O₃)和总挥发性有机化合物(TVOC)浓度。(status & 0x80)) // 检查数据就绪位。// 等待测量完成 (实际应用中应该使用非阻塞方式)// 转换为ppb (简化转换,实际应根据传感器文档校准)* @param hzmod: ZMOD4510句柄。* @param tvoc: TVOC浓度(ppb)* @param ozone: 臭氧浓度(ppb)* @param hi2c: I2C句柄。

corlin6688的博客 311

history 历史命令记录功能如何防坏人(高级)

在 Linux 下面可以使用 history 命令查看用户的所有历史操作,同时 shell 命令操作记录默认保存在用户目录的 .bash_history 文件中。通过这个文件可以查询 shell 命令的执行历史,有助于运维人员进行系统审计和问题排查,同时在服务器遭受黑客攻击后,也可以查询黑客登录服务器的历史命令操作。但是黑客在入侵后,为了抹除痕迹,会删除 .bash_history 文件,这个就需...

墨痕诉清风的博客 1656

2017微软秋季校园招聘在线编程笔试(第三题)

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

accelerator_2016的博客 1083

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

2017微软秋季校园招聘在线编程笔试 Composition (DP)

2017微软秋季校园招聘在线编程笔试 1400 : Composition hihocoder

快乐的小鸟_ZJU 1554

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

2017微软秋季校园招聘在线编程笔试-#1402 : MS Recognition

http://hihocoder.com/problemset/problem/1402 题意理解:M和S都很大,并且相互离的很远,M和S的两个端点不一样,M不平衡,所以端点的中点到重心的距离和端点的距离比值》0.5就是M。很奇怪为什么画一条支线看个数会不行,或者是参数设置的不好? 急转弯:端点和重心,距离关系 算法:bfs找端点 数据结构:无 from __

ruclion的专栏 418

2017微软秋季校园招聘在线编程笔试(第二题)

2017微软秋季校园招聘在线编程笔试(第二题) 描述 Alice writes an English composition with a length of N characters. However, her teacher requires that M illegal pairs of characters cannot be adj

accelerator_2016的博客 910

2017微软秋季校园招聘在线编程笔试(第一题)

题目大意:         有一个由n个数组成的数列,如果相邻的两个数和为奇数,则这两个数可以消去,问怎么消可以使剩下的数字最少。 解题思路:         无论怎么消结果都是一定的,所以直接贪心即可。 代码: #include #include using namespace std; int n,now; stack s; int main() { scanf("

accelerator_2016的博客 707

hihoCoder 1399 Shortening Sequence

2017微软秋季校园招聘在线编程笔试A 看N的范围就知道是用什么复杂度的算法了 用个stack存就好了 #define LOG(x) cout << #x << " = " << (x) << endl #define PRINTLN(x) cout << (x) << endl #define MEM(x, y) memset((x), (y), sizeof((x))) #in

more time 606
上一篇: hihoCoder #1032 : 最长回文子串(manacher)
下一篇: hihoCoder 1041 国庆出游
左眼皮跳跳~
博客等级 码龄13年 17粉丝 400原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值