微软在线笔试题2015

描述

We say a stringis beautiful if it has the equal amount of 3 or more continuous letters (inincreasing order.)

Here are someexample of valid beautiful strings: "abc", "cde","aabbcc", "aaabbbccc".

Here are someexample of invalid beautiful strings: "abd", "cba","aabbc", "zab".

Given a stringof alphabets containing only lowercase alphabets (a-z), output "YES"if the string contains a beautiful sub-string, otherwise output "NO".

输入

The first linecontains an integer number between 1 and 10, indicating how many test cases arefollowed.

For each testcase: First line is the number of letters in the string; Second line is thestring. String length is less than 10MB.

输出

For each testcase, output a single line "YES"/"NO" to tell if the stringcontains a beautiful sub-string.

提示

Huge input. SlowIO method such as Scanner in Java may get TLE.

样例输入

4

3

abc

4

aaab

6

abccde

3

abb

样例输出

YES

NO

YES

NO

时间限制:8000ms

单点时限:1000ms

内存限制:256MB

描述

You are given atxt file, which is performance logs of a single-threaded program.

Each line hasthree columns as follow:

[Function Name][TimeStamp] [Action]

[FunctionName]is a string of length between 1~255

[TimeStamp]format is hh:mm:ss

Valid values for"Action" column are START or END, marking the start or end of afunction call.

Each functionwill only be called once.

Output thedepth-first traversal result of the call graph with the total time of eachfunction call. However, sometimes the performance log isn‘t correct and at thattime you just need to output "Incorrect performance
log".

输入

The input onlycontains 1 case, first line is a positive number N representing the number oflogs(1 <= N <= 20000), then there are N lines in next, each line is thelog info containing [Function Name] [TimeStamp] [Action],
[Function Name] is astring, you can assume the [Function Name] is distinct and the length between1~255.

输出

Output thedepth-first traversal result of the call graph with the total time of eachfunction call for the correct performance, or output "Incorrectperformance log".

提示

A call graph isa directed graph that represents calling relationships between subroutines in acomputer program.

Call graph forthe sample input is shown as below:

Another sampletest case.


Sample Input


Sample Output


8

FuncA 00:00:01 START

FuncB 00:00:02 START

FuncC 00:00:03 START

FuncA 00:00:04 END

FuncB 00:00:05 END

FuncD 00:00:06 START

FuncD 00:00:07 END

FuncC 00:00:08 END


Incorrect performance log

样例输入

8

FuncA 00:00:01 START

FuncB 00:00:02 START

FuncC 00:00:03 START

FuncC 00:00:04 END

FuncB 00:00:05 END

FuncD 00:00:06 START

FuncD 00:00:07 END

FuncA 00:00:08 END

样例输出

FuncA 00:00:07

FuncB 00:00:03

FuncC 00:00:01

FuncD 00:00:01

窗体顶端

EmacsNormalVim

时间限制:10000ms

单点时限:1000ms

内存限制:256MB

描述

We define thematching contents in the strings of strA and strB as common substrings of thetwo strings. There are two additional restrictions on the common substrings.

The firstrestriction here is that every common substring‘s length should not be less than3.  For example:

strA: abcdefghijklmn

strB: ababceghjklmn

The matchingcontents in strA and strB are substrings ("abc", "jklmn").Note that though "e" and "gh" are common substrings of strAand strB, they are not matching content because their lengths are less than 3.

The secondrestriction is that the start indexes of all common substrings should bemonotone increasing. For example:

strA: aaabbbbccc

strB: aaacccbbbb

The matchingcontents in strA and strB are substrings ("aaa", "bbbb").Note that though "ccc" is common substring of strA and strB and haslength greater than 3, the start indexes of ("aaa", "bbbb","ccc") in strB are
(0, 6, 3), which is not monotone increasing.

输入

Two lines. Thefirst line is strA and the second line is strB. Both strA and strB are oflength less than 2100.

输出

The length ofmatching contents (the sum of the lengths of the common substrings).

样例输入

abcdefghijklmn

ababceghjklmn

样例输出

8

时间限制:10000ms

单点时限:1000ms

内存限制:256MB

描述

Finally, youcome to the interview room. You know that a Microsoft interviewer is in theroom though the door is locked. There is a combination lock on the door. Thereare N rotators on the lock, each consists of 26
alphabetic characters, namely,‘A‘-‘Z‘. You need to unlock the door to meet the interviewer inside. There is anote besides the lock, which shows the steps to unlock it.

Note: There areM steps totally; each step is one of the four kinds of operations shown below:

Type1: CMD1 i j X: (i and j are integers, 1 <= i <= j <= N; X is a character,within ‘A‘-‘Z‘)

This is asequence operation: turn the ith to the jth rotators to character X (the leftmost rotator is defined as the 1st rotator)

For example: ABCDEFG => CMD 1 2 3 Z => AZZDEFG

Type2: CMD2 i j K: (i, j, and K are all integers, 1 <= i <= j <= N)

This is asequence operation: turn the ith to the jth rotators up K times ( if characterA is turned up once, it is B; if Z is turned up once, it is A now. )

For example: ABCDEFG => CMD 2 2 3 1 => ACDDEFG

Type3: CMD3 K: (K is an integer, 1 <= K <= N)

This is aconcatenation operation: move the K leftmost rotators to the rightmost end.

For example: ABCDEFG => CMD 3 3 => DEFGABC

Type4: CMD4 i j(i, j are integers, 1 <= i <= j <= N):

This is arecursive operation, which means:

If i > j:

DoNothing

Else:

CMD4 i+1 j

CMD2 i j 1

For example: ABCDEFG => CMD 4 2 3 => ACEDEFG

输入

1st line: 2 integers, N, M ( 1 <= N <= 50000, 1 <= M <= 50000 )

2nd line: astring of N characters, standing for the original status of the lock.

3rd ~ (3+M-1)thlines: each line contains a string, representing one step.

输出

One line of Ncharacters, showing the final status of the lock.

提示

Come on! Youneed to do these operations as fast as possible.

样例输入

7 4

ABCDEFG

CMD 1 2 5 C

CMD 2 3 7 4

CMD 3 3

CMD 4 1 7

样例输出

HIMOFIN

窗体底端

时间: 2024-10-25 20:06:15

微软在线笔试题2015的相关文章

2015微软实习在线笔试题 - Professor Q&#39;s Software

时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Professor Q develops a new software. The software consists of N modules which are numbered from 1 to N. The i-th module will be started up by signal Si. If signal Si is generated multiple times, the i-th module

2015阿里巴巴前端实习生在线笔试题

Summary 大公司开始招实习生了,我也变成过来人了,品味到之前的酸甜苦辣,除了加油好像也没法说那么多. 因为是你在奋斗,心态这件事是你们在掌握的.但是我们唯一能提供的是我们topview实验室新鲜出炉的面经和笔试. (其实我在想有没应届生春招 - -!) Where 2015阿里巴巴前端实习生在线笔试题

2015.8.29某高级企业的在线笔试题

收集了今年阿里的在线笔试题,贴出来供需要的朋友参考. 1.下面的函数中哪个是系统调用而不是库函数______?printfscanffgetcreadprint_sscan_s 2.某足球队有四名外援,分别来自巴西.荷兰.意大利和美国.他们分别擅长前锋.后卫或守门,其中:① 美国外援单独擅长守门:② 意大利外援不擅长前锋:③ 巴西外援和另外某个外援擅长相同的位置:④ 荷兰外援擅长的位置和巴西外援不同.以上条件可以推出巴西外援擅长的位置是______.前锋守门后卫前锋或守门后卫或守门前锋或后卫 3

2015年阿里巴巴校招研发工程师在线笔试题汇总

在线笔试题汇总 卷一: 1.下面的函数中哪个是系统调用而不是库函数______? printf scanf fgetc read print_s scan_s 2.某足球队有四名外援,分别来自巴西.荷兰.意大利和美国.他们分别擅长前锋.后卫或守门,其中: ① 美国外援单独擅长守门: ② 意大利外援不擅长前锋: ③ 巴西外援和另外某个外援擅长相同的位置: ④ 荷兰外援擅长的位置和巴西外援不同. 以上条件可以推出巴西外援擅长的位置是______. 前锋 守门 后卫 前锋或守门 后卫或守门 前锋或后卫

2014阿里巴巴WEB前端实习生在线笔试题

2014年3月31日晚,我怀着略微忐忑的心情(第一次在线笔试^_^!!)进行了笔试,阿里巴巴的笔试题共有10道,几乎包含了Web前端开发的各个方面,有程序题.有叙述题,时间非常紧张,只完成了大概6道题.下面把遇到的题目跟大家分享一下! 1. <pre name="code" class="html"><!doctype html> <html> <head> <style type="text/css&

48行代码解一道亚马逊的在线笔试题

这题是我从这里看到的一道亚马逊的在线笔试题,具体规则请前往该文章查看,下面贴出我的解题代码: 其中11,12,13,14分别代表J,Q,K,A; class CardCompare { private int[] cards = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; public bool CompareCards(int[] cards1, int[] cards2) { return cardsScore(card

2014年阿里巴巴在线笔试题-第3大题-公共最长字符串长度

说明 2014年阿里巴巴在线笔试题-第3大题    首先,我没参加这次的阿里巴巴在线笔试题,题目全部是从别人口中描述而来,对于以下的分析,如果有什么不对的地方还望指教.也希望大家能够有更好的办法,希望大家来能不吝赐教. 题目描述 给定一个主字符串和一个匹配字符串,现在问你,找出 "主串中可匹配到的匹配串中子串的最大长度",可能比较绕,举个例子吧 主字符串       abcdefgsdff     记为A 匹配字符串   abefgf               记为B 要求的值就是 

google 2014在线笔试题

1.个人做google在线笔试题感觉时间很紧,笔试时间只做出来了一个题目就是第二道题,这第一道题是当天晚上才做出来的...突然感觉自己很水... 个人解决方案需要解决如下子问题 1)判断一个具有坏灯管的数字灯是否显示的是某个数字 2)判断一串灯管显示的是否是以某个数字为首递减的一串数字 3)检查一串匹配正确数字的灯管中坏掉的灯管是哪些 4)输出显示一串正确递减数字的灯管 4)输出显示一串有坏灯管的来显示数字的灯管 #include<iostream> #include <map>

ThoughtWorks西邮暑期特训营--JavaScript在线笔试题

ThoughtWorks 公司在西邮正式开办的只教女生前端开发的女子卓越实验室已经几个月过去了,这次计划于暑期在西邮内部开展面向所有性别所有专业的前端培训. 具体官方安排请戳:ThoughtWorks 西安邮电大学暑期特训营(2016). 不知为期7-18至8-26六周.每周6天.每天8小时的训练后,我这个本学PHP走服务端的Someone前端能力会有多么厉害,期待ING. 这篇博客把自己当时摘抄的 ThoughtWorks 在线 JavaScript 笔试题和自己相应的解答代码从笔记中整理出来