摘要:题目链接Problem StatementYour Maths professor is a very nice guy, but he sometimes comes up with not so funny tasks. Today is one such day. The professor ...
阅读全文
摘要:题目链接Problem StatementAs you are probably aware, the Internet protocols specify a canonical byte order convention for data transmitted over the network...
阅读全文
摘要:题目链接Problem StatementCodenationis sendingNof its employees to a High Profile Business Conference and the goal is to cover maximum number of presentati...
阅读全文
摘要:题目链接Problem StatementAt Quora, we run all our unit tests across many machines in a test cluster on every code push.One day, we decided to see if we co...
阅读全文
摘要:题目链接题目需要得到树上每个结点出发可到达的最远的结点,顺便求出树的直径。这里顺便总结一下求解的两种方法。第一种思路:三种dfs(bfs) 第一遍dfs(bfs)从任意结点出发,找到距离该结点最远的结点u(直径的端点之一)。 第二遍dfs(bfs)从u出发,求出其他点到u的距离,最长的即为v(直...
阅读全文
摘要:拖了近一个月的总结。(可能源于最近不太想做事:()A题给出n个长度都为n的字符串,你只可以对每个字符串分别排序,问当每个字符串按升序排序之后,每一列是否也是升序的。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using...
阅读全文
摘要:比赛链接A题如果当前数是1,那么后面无论是几都会加1或者当后面数是1的时候加2,所以记录一下后面的数中1的个数(加2)即可。如果当前数是2,那么只有当后面的数为1或者为2时才可以加1,所以再记录一下后面数中2的个数即可。 1 #include 2 #include 3 #include 4 #...
阅读全文
摘要:一拖再拖,忍无可忍,自己懒的没救了。一周前就结束的比赛,到现在才想起来补。最后一题貌似又遇到了splay。。。还是不会!!!shit题目链接A题--快速幂 1 #include 2 #include 3 #include 4 #include 5 #include 6 using name...
阅读全文
摘要:A题模拟 1 T = int(input()) 2 while T: 3 T -= 1 4 s = raw_input() 5 n = len(s) 6 res, pre = 0, 0 7 for i in xrange(1, n): 8 if...
阅读全文
摘要:题目链接Some scientists are working on protein recombination, and during their research, they have found a remarkable fact: there are 4 proteins in the pr...
阅读全文