Codeforces 1145 題目分析

cakn發表於2024-11-20

本文將分析 Codeforces 1145 (April Fools Day Contest 2019)。

題目分析

A

題目描述:使用“滅霸排序”演算法可以得到的最長子串的長度。
解法:暴力。

B

題目描述:輸入一個整數 \(\in [1,99]\),若它的英文形式含有 knba 四個字母輸出 NO 否則輸出 YES
解法:打表。

C

題目描述:

image
輸入一個整數 \(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

直接模擬即可。

相關文章