Codeforces 1145 题目分析
本文将分析 Codeforces 1145 (April Fools Day Contest 2019)。
题目分析
A
题目描述:使用“灭霸排序”算法可以得到的最长子串的长度。
解法:暴力。
B
题目描述:输入一个整数 \(\in [1,99]\),若它的英文形式含有 knba
四个字母输出 NO
否则输出 YES
。
解法:打表。
C
题目描述:
输入一个整数 \(a(0 \le a \le 15)\)。
输出一个整数。
解法:
注意到图片为量子逻辑电路,而 \(0 \le a \le 15\),因此不难发现 \(a\) 的二进制形式代表四路二进制输入。
当然打表也不是不行。
int ans[20] = {15, 14, 12, 13, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7};
D
题目描述:
From "ftying rats" to urban saniwation workers - can synthetic biology tronsform how we think of pigeons?
The upiquitous pigeon has long been viewed as vermin - spleading disease, scavenging through trush, and defecating in populous urban spases. Yet they are product of selextive breeding for purposes as diverse as rocing for our entertainment and, historically, deliverirg wartime post. Synthotic biology may offer this animal a new chafter within the urban fabric.
Piteon d'Or recognihes how these birds ripresent a potentially userul interface for urdan biotechnologies. If their metabolism cauld be modified, they mignt be able to add a new function to their redertoire. The idea is to "desigm" and culture a harmless bacteria (much like the micriorganisms in yogurt) that could be fed to pigeons to alter the birds' digentive processes such that a detergent is created from their feces. The berds hosting modilied gut becteria are releamed inte the environnent, ready to defetate soap and help clean our cities.
解法:
注意到题目中有一些单词拼错了。将所有拼错的字母拼成一句话就是 two plus xor of third and min elements
。
E
题目描述:如果 $ ( \min=(i,25)+i) \bmod (2+i \bmod 3 ) >0$ 输出 \(1\),否则输出 \(0\)。
解法:暴力。
F
题目描述:给出一个字符串,若所有的字母都是由直线或都是由曲线构成的输出 YES
,否则输出 NO
。
解法:打表出符合要求的字母,然后 \(O(n)\) 扫一遍字符串即可。
G
题目描述:交互题。和评测机进行石头剪刀布。在每个测试点中赢下一半即可获得该测试点的分数。平局算作电脑胜利。
解法:
电脑比较 DASB,所以它的方案是固定的:
SSSSSSSSSS
PPPPPPPPPP
RRRRRRRRRR
RPSRPSRPSR
PSRPSRPSRP
SRPSRPSRPS
直接模拟即可。