随笔分类 - 日常作业
摘要:Description For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a g
阅读全文
摘要:描述 The GX Light Pipeline Company started to prepare bent pipes for the new transgalactic light pipeline. During the design phase of the new pipe shape
阅读全文
摘要:描述 The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most dis
阅读全文
摘要:描述 Being the only living descendant of his grandfather, Kamran the Believer inherited all of the grandpa's belongings. The most valuable one was a pie
阅读全文
摘要:题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into account, he wants to plant enough grass in each of his f
阅读全文
摘要:描述 人们熟悉的四则运算表达式称为中缀表达式,例如(23+34*45/(5+6+7))。在程序设计语言中,可以利用堆栈的方法把中缀表达式转换成保值的后缀表达式(又称逆波兰表示法),并最终变为计算机可以直接执行的指令,得到表达式的值。给定一个中缀表达式,编写程序,利用堆栈的方法,计算表达式的值。输入第
阅读全文
摘要:题目描述 农民约翰的农场里有N座山峰(1<=N<=1000),每座山都有一个在0到100之间的整数的海拔高度。在冬天,因为山上有丰富的积雪,约翰经常开办滑雪训练营。 不幸的是,约翰刚刚得知税法在滑雪训练营方面有新变化,明年开始实施。在仔细阅读法律后,他发现如果滑雪训练营的最高和最低的山峰海拔高度差大
阅读全文
摘要:题目描述 After realizing that there is much money to be made in software development, Farmer John has launched a small side business writing shortprograms
阅读全文
摘要:描述 Let us consider a special type of a binary search tree, called a cartesian tree. Recall that a binary search tree is a rooted ordered binary tree,
阅读全文
摘要:描述 输入 包括多组数据,每组数据的第一行是整点的个数n(1<=n<=1000),其后n行每行由两个整数组成,表示一个点的x、y坐标。输入保证一组数据中不会出现相同的点,且坐标的绝对值小于等于20000。输入以一组n=0的数据结尾。输出对于每组输入数据,输出一个数,表示这组数据中的点可以组成的正方形
阅读全文
摘要:描述 给定N个数的序列a1,a2,...aN,定义一个数对(ai, aj)为“重要逆序对”的充要条件为 i < j 且 ai > 2aj。求给定序列中“重要逆序对”的个数。 输入 第一行为序列中数字的个数N(1 ≤ N ≤ 200000)。第二行为序列a1, a2 ... aN(0 ≤a ≤ 100
阅读全文
摘要:描述 给出n个由小写字母组成的字符串,求一个最长的字符串,它同时是这n个字符串的子串。 输入 第一行是一个整数n(1<=n<=5),表示输入字符串的个数。接下来n行每行为一个由小写字母构成的字符串,每个字符串的长度至少为1,最长不超过2000。输出输出一行整数,为最长公共子串的长度。 样例输入 样例
阅读全文
摘要:描述 奶牛们打算通过锻炼来培养自己的运动细胞,作为其中的一员,贝茜选择的运动方式是每天进行N(1 <= N <= 10,000)分钟的晨跑。在每分钟的开始,贝茜会选择下一分钟是用来跑步还是休息。 贝茜的体力限制了她跑步的距离。更具体地,如果贝茜选择在第i分钟内跑步,她可以在这一分钟内跑D_i(1 <
阅读全文
摘要:描述 There has been considerable archeological work on the ancient Myacm culture. Many artifacts have been found in what have been called power fields:
阅读全文
摘要:描述 We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no
阅读全文
摘要:描述 In an edge-weighted tree, the xor-length of a path pis defined as the xor sum of the weights of edges on p: ⊕ is the xor operator. We say a path th
阅读全文
摘要:描述 The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born bab
阅读全文
摘要:描述 系统A用来维护客户。每个客户的id用一个正整数K来表示,当客户进入系统时用P来表示此用户的优先度。这个系统有以下请求 0 系统停止运行 1 K P 优先度为P的客户K进入系统 2 找到优先度最高的客户,然后此客户离开系统 3 找到优先度最低的客户,然后此客户离开系统 输入 每行包括一个请求,最
阅读全文
摘要:描述 吉老师的面前出现了一座汉诺塔!但是这个汉诺塔好像坏了,盘子并不是按照从大到小的顺序排列的……吉老师非常不开心,立志要把这个汉诺塔修好!吉老师每分钟可以交换挨在一起的两个盘子,吉老师希望用的时间最短,吉老师不会啊,你能帮帮吉老师吗? 输入 第一行1个整数N。第二行为N 个非负整数,按从下到上的顺
阅读全文
摘要:描述 你旅游到了一个国外的城市。那里的人们说的外国语言你不能理解。不过幸运的是,你有一本词典可以帮助你。 输入首先输入一个词典,词典中包含不超过100000个词条,每个词条占据一行。每一个词条包括一个英文单词和一个外语单词,两个单词之间用一个空格隔开。而且在词典中不会有某个外语单词出现超过两次。词典
阅读全文