F.Four-tuples
摘要:原题链接 https://ac.nowcoder.com/acm/contest/123/F 思路 四个集合的容斥原理:|A∪B∪C∪D|=|A|+|B|+|C|+|D|-|A∩B|-|A∩C|-|A∩D|- |B∩C| - |B∩D| - |C∩D|+|A∩B∩C|+|A∩B∩D|+|A∩C∩D|
阅读全文
posted @
2021-05-07 16:38
Laurance
阅读(94)
推荐(0)
E.Sequence
摘要:原题链接 https://ac.nowcoder.com/acm/contest/123/E 思路 题意是给出一个序列和好数的定义,所谓好数就是对于一个数a[i],存在一个a[j](j < i),使得a[i] > a[j],就是在它前面如果有比它小的数,那它就是好数。那么对于一个序列,可以设置一个第
阅读全文
posted @
2021-05-07 16:33
Laurance
阅读(69)
推荐(0)
D.Dance
摘要:原题链接 https://ac.nowcoder.com/acm/contest/123/D 思路 题意比较复杂,大致意思是说给了一棵树,根节点是0号点,然后需要我们从叶节点开始往上走,每个节点都有一个价值和一个次数,我们每次往上走需要花费一个次数,问所有从叶节点开始往上走到根节点的路径价值之和是多
阅读全文
posted @
2021-05-07 15:43
Laurance
阅读(71)
推荐(0)
C.Cities
摘要:原题链接 https://ac.nowcoder.com/acm/contest/123/C 思路 题意是最少花费多大的代价可以将所有城市连通,在两个城市之间建一条路的花费是两个城市的价值之和,那么直接贪心即可,找出价值最小的城市,用它来连接所有城市即可。 代码 #include <iostream
阅读全文
posted @
2021-05-07 15:31
Laurance
阅读(83)
推荐(0)
A.Anagram
摘要:原题链接 https://ac.nowcoder.com/acm/contest/123/A 思路 题目的意思是说,最少经过多少次变化,能将一个串变为另一个串的相似串,相似串的意思是:两个串中同样的字母数相同,例如:ABCD和BADC。那么对于这个题看数据范围只有50可以轻易的想到暴力枚举即可,时间
阅读全文
posted @
2021-05-07 15:22
Laurance
阅读(79)
推荐(0)
I.找路(Roads? Where We Are Going, We Don’t Need Roads.)
摘要:题目描述 The National Road Service (NRS) wanted to make some changes to make sure that people are correctly ocially distancing from each other. However, N
阅读全文
posted @
2021-04-10 17:18
Laurance
阅读(317)
推荐(0)
E.税收问题(Pesky Publicans)
摘要:题目描述 Tax collectors in the Roman empire, called publicans, are not well perceived, and for good reason. However, they are necessary for the running of
阅读全文
posted @
2021-04-10 15:27
Laurance
阅读(89)
推荐(0)
H.蹦床跳跃(Jump Conveyor)
摘要:题目描述 Emma is a creative child who got bored during the quarantine season. She set up n trampolines in a line inside the living room, each aimed in a p
阅读全文
posted @
2021-04-10 15:15
Laurance
阅读(177)
推荐(0)
I
摘要:题目描述 Listening to the rock music permutes your nuclear DNA. This astonishing and unbelievable fact was recently published in the Rock Nature Weekly, o
阅读全文
posted @
2021-04-09 14:34
Laurance
阅读(402)
推荐(0)
F
摘要:题目描述 Boris is the chief executive officer of Rock Anywhere Transport (RAT) company which specializes in supporting music industry. In particular, they
阅读全文
posted @
2021-04-08 17:27
Laurance
阅读(442)
推荐(0)
A
摘要:题目描述 Fernando was hired by the University of Waterloo to finish a development project the university started some time ago. Outside the campus, the un
阅读全文
posted @
2021-04-07 20:55
Laurance
阅读(86)
推荐(0)
A
摘要:题目描述 Carryless addition is the same as normal addition, except any carries are ignored (in base 10). Thus, 37 + 48 is 75, not 85. Carryless multiplica
阅读全文
posted @
2021-04-07 17:52
Laurance
阅读(148)
推荐(0)
J
摘要:题目描述 You are given a sequence of n integers x = [x1,x2,...,xn] and an integer k . It is guaranteed that 1 ≤ xi ≤ k , and every integer from 1 to k app
阅读全文
posted @
2021-04-07 15:22
Laurance
阅读(150)
推荐(0)
D
摘要:题目描述 A set of words is called swap free if there is no way to turn any word in the set into any other word in the set by swapping only a single pair o
阅读全文
posted @
2021-04-07 15:12
Laurance
阅读(94)
推荐(1)