SkyWT

Blog

Capturing my Thoughts,
Hoping to Connect with Yours.

Page 12 / 20

快看看 CCF 是怎么把初赛完成脑筋急转弯竞赛的……

孙某和张某是考古学家老李的学生。有一天,老李拿了一件古物来考验两人,两人都无法验证出来这件古物试谁的。老李告诉了孙某拥有者的姓,告诉张某拥有者的名,并且在纸条上写下以下几个人的人名,问他们知道谁才是拥有者? 纸条上的名字有:沈万三、岳飞、岳云、张飞、张良、张鹏、赵括、赵云、赵鹏、沈括。

  • 孙某说:如果我不知道的话,张某肯定也不知道。
  • 张某说:刚才我不知道,听孙某一说,我现在知道了。
  • 孙某说:哦,那我也知道了。

请问:那件古物是谁的?

Description

Link: LightOJ 1873 DNA Sequence

You are given a list of strings over the alphabet A (for adenine), C (cytosine), G (guanine), and T (thymine), and your task is to find the shortest string (which is typically not listed) that contains all given strings as substrings. If there are several such strings of shortest length, find the smallest in alphabetical/lexicographical order.

Time Limit: 4 second(s) Memory Limit: 32 MB

$$ \begin{bmatrix} x_{11} & x_{12} & x_{13} \ x_{21} & x_{22} & x_{23} \ x_{31} & x_{32} & x_{33} \end{bmatrix} $$

每增加一个维度,世界便会增加无限的美感。

数学上,高斯消元法(Gaussian Elimination),是线性代数中的一个算法,可用来为线性方程组求解,求出矩阵的秩,以及求出可逆方阵的逆矩阵。当用于一个矩阵时,高斯消元法会产生出一个行梯阵式。

解多元方程组特别方便。

简单来说,数位 DP 大概就是把一个数字拆开按位进行 DP 的一种思想。

HDU 3555 Bomb

The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number sequence includes the sub-sequence "49", the power of the blast would add one point. Now the counter-terrorist knows the number N. They want to know the final points of the power. Can you help them?

Linux 下没有 Dev-cpp,每次遇到想要调试的代码就是坠痛苦的。所以我们还是得学点 gdb 调试的命令。

首先执行 g++ a.cpp -g,生成 a.out 或者 a.exe; 执行 gdb a.out,出现一大段介绍,进入 gdb 调试。

主定理可以用来分析递归算法的时间复杂度(也叫渐进复杂度)。在以前,我们知道快速排序的时间复杂度是 $ \Theta (N \ast \log_2 N )$ ,我们也知道它不稳定,但是我们仿佛不知道这个 $ \Theta (N \ast \log_2 N )$ 是怎么来的……学习了主定理,我们就可以证明了~

这个“主定理”名字真的十分霸气:Master Theorem……

很多题目的贪心想法都是一个简单粗暴的贪心加上可“反悔”的操作。这样可以确保答案的正确性。

Description

You're Zhu Rengong, a formidable hero. After a number of challenging missions, you are finally facing the final Boss – a black dragon called Heilong. Due to his overwhelming power, you have to plan your actions carefully.

坠痛苦的是,POJ 的辣鸡 G++ 编译器不支持 long long,害得我调试调了半天……

Description

For every pair of triplets, $T_a = (I_a, J_a, K_a)$ and $T_b = (I_b, J_b, K_b)$, we define the difference value between $T_a$ and $T_b$ as follows:

$$ D(T_a, T_b) = \max (I_a − I_b, J_a − J_b, K_a − K_b) − \min (I_a − I_b, J_a − J_b, K_a − K_b) $$

Now you are given $N$ triplets, could you write a program to calculate the sum of the difference values between every unordered pair of triplets?