摘要:Getting in Line Computer networking requires that the computers in the network be linked. This problem considers a ``linear" network in which the computers are chained together so that each is...
阅读全文
摘要:Bandwidth Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an ordering on the elements in V, then the bandwidth of a node v is defined as the maximum distance in ...
阅读全文
摘要:// Rujia Liu // 题意:给出n个带权集合,每个集合包含1~9中的三个整数。找出其中三个集合,使得1~9恰好各出现一次,且权和最大 // 算法:暴力n^2枚举前两个集合,直接计算出第三个集合。用位运算让代码更简单,速度也更快 学习点: 1、全集ALL为(1#include#includeusing namespace std;const int maxn = 1000 +...
阅读全文
摘要:题意:神人鬼三个种族,神只说真话,鬼只说假话,人白天说真话,晚上说假话。根据对话内容区分种族和白天黑夜。 最多有A, B, C, D, E五个人 算法:枚举A, B, C, D, E的种族情况和白天黑夜的情况。每个人有可能是神人鬼,所以用两个bit表示,白天黑夜用1个bit表示。一共需要11 bits. #include#include#includeusing names...
阅读全文
摘要:// 题意:有P个LED灯,以及N个字符,要求选出个数最少的LED灯,使得即使只有这些灯正常工作,也能区分出这N个字符 // 题意抽象:输入两个整数P, N以及N行P列的01矩阵,找少的列,能区分所有行 // 规模:P#include#include#include#include#includeusing namespace std;const int P=15;const i...
阅读全文
摘要:Problem G. Birthday Cake Background Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them.Now we put the cake onto a Descartes coordinate. Its center is at (...
阅读全文