果冻, 192个 191字节
-1通过使用Ɗ
(自快速开发以来)
“¦UV2ḤF2ı½ṅḶḊ⁼5JI5MẇvẋẊẊ¬Ḥḳ'ƈ<ḷėƤ7*⁾ṾxMæS⁺`?^Ƭb¦ɗDß⁼pþɲOṃ⁽2Ė>,Ḣ(ḞŒƊOGƤ×⁺ṇṂ®ȤT0y°^Ẇ⁺:Þ]ṢṬ¶ịṪḂƇ ñAƬCṫ$wÆĿĖỴỴƇẓƊqḌ@;ẏ`ṃFƥḣ⁽²»ḟ⁶s2;“¤²R.ȯ7ŒL£ɦ»Œt
Œte¢
ŒṖµL€=1oÇ€ṂµÐfµṡ2;€ÇÐfÇ€€S€¬SµÐḟ⁾[]jŒtƊ¹Ç?€€
在线尝试!-在60秒内完成“ Stack Exchange”测试用例的效率太低(离线运行它会在2分钟内给出正确的结果)。
怎么样?
代码的第一行是一条尼拉度链接,用于创建包含所有118个元素符号的列表。为此,它连接了两个列表,第一个包含所有长度为2的字符(即字符串)列表,第二个包含字符列表和标题列表(结果列表)。这两个列表本身主要是通过在Jelly词典中查找单词以创建单个字符串来创建的。
这些压缩的第一个是:
“¦UV2ḤF2ı½ṅḶḊ⁼5JI5MẇvẋẊẊ¬Ḥḳ'ƈ<ḷėƤ7*⁾ṾxMæS⁺`?^Ƭb¦ɗDß⁼pþɲOṃ⁽2Ė>,Ḣ(ḞŒƊOGƤ×⁺ṇṂ®ȤT0y°^Ẇ⁺:Þ]ṢṬ¶ịṪḂƇ ñAƬCṫ$wÆĿĖỴỴƇẓƊqḌ@;ẏ`ṃFƥḣ⁽²»
产生
" biznagas sepmag ratbag catchflies paracmes mdse bharal ramcat monopteros irrepressibilities lunarnauts geniculate hopbinds rutabaga potlache broghs bergamas crossbirth purblind xebecs nonhardy classism fleurets moneybag scarce corf Mg Sr Zr CD HG CF FM Lr SG TM Gd Bk Fr Rh Fe Sn lv cndbmnnbkrmtpdnp"
除了最后一个条目(由空格分隔)之外的所有条目都是Jelly词典中的条目。用过滤掉空格ḟ⁶
,然后将结果分成两部分:
["bi","zn","ag","as","se","pm","ag","ra","tb","ag","ca","tc","hf","li","es","pa","ra","cm","es","md","se","bh","ar","al","ra","mc","at","mo","no","pt","er","os","ir","re","pr","es","si","bi","li","ti","es","lu","na","rn","au","ts","ge","ni","cu","la","te","ho","pb","in","ds","ru","ta","ba","ga","po","tl","ac","he","br","og","hs","be","rg","am","as","cr","os","sb","ir","th","pu","rb","li","nd","xe","be","cs","no","nh","ar","dy","cl","as","si","sm","fl","eu","re","ts","mo","ne","yb","ag","sc","ar","ce","co","rf","Mg","Sr","Zr","CD","HG","CF","FM","Lr","SG","TM","Gd","Bk","Fr","Rh","Fe","Sn","lv","cn","db","mn","nb","kr","mt","pd","np"]
第二,
“¤²R.ȯ7ŒL£ɦ»
由单词“ finch”,“ pub”,“ sky”和“ vow”(不带空格)的串联组成,因此是一个字符列表:
['f','i','n','c','h','p','u','b','s','k','y','v','o','w']
这两个列表是用串联在一起的;
,每个条目都使用进行标题大小写转换Œt
,产生:
["Bi","Zn","Ag","As","Se","Pm","Ag","Ra","Tb","Ag","Ca","Tc","Hf","Li","Es","Pa","Ra","Cm","Es","Md","Se","Bh","Ar","Al","Ra","Mc","At","Mo","No","Pt","Er","Os","Ir","Re","Pr","Es","Si","Bi","Li","Ti","Es","Lu","Na","Rn","Au","Ts","Ge","Ni","Cu","La","Te","Ho","Pb","In","Ds","Ru","Ta","Ba","Ga","Po","Tl","Ac","He","Br","Og","Hs","Be","Rg","Am","As","Cr","Os","Sb","Ir","Th","Pu","Rb","Li","Nd","Xe","Be","Cs","No","Nh","Ar","Dy","Cl","As","Si","Sm","Fl","Eu","Re","Ts","Mo","Ne","Yb","Ag","Sc","Ar","Ce","Co","Rf","Mg","Sr","Zr","Cd","Hg","Cf","Fm","Lr","Sg","Tm","Gd","Bk","Fr","Rh","Fe","Sn","Lv","Cn","Db","Mn","Nb","Kr","Mt","Pd","Np","F","I","N","C","H","P","U","B","S","K","Y","V","O","W"]
包含所有118个必需元素符号的列表(有重复项,但是可以)。
第二行代码是monadic链接(一种用于接受一个输入的辅助函数),如果输入的标题大小写存在于上面创建的列表中,则返回1,否则返回0。
第三行代码是主链接,这是一个单子函数,它接受一个字符串并根据需要返回一个字符列表(即字符串)的列表:
ŒṖµL€=1oÇ€ṂµÐfµṡ2;€ÇÐfÇ€€S€¬SµÐḟ⁾[]jŒtƊ¹Ç?€€ - Main link: s
ŒṖ - all partitions of s
µ µÐf - filter keep:
L€=1 - length €ach equals (vectorises) 1
o - or
Ç€ - last link as a monad (is an element when title-cased)
Ṃ - minimum
- (i.e. all partitions that are all single characters OR are strings that when title-cased are elements)
µ µÐḟ - filter discard:
ṡ2 - slices of length 2
;€ - concatenate €ach
Ðf - filter keep:
Ç - last link as a monad (is an element when title-cased)
Ç€€ - last link as a monad for €ach for €ach
S€ - sum €ach
¬ - logical not
S - sum
- (i.e. discard any partitions that contain a run of two that joined together and title-cased ARE an element but separately NEITHER are)
?€€ - if then else for €ach (partition) for €ach (part):
Ç - IF: last link as a monad (is an element when title-cased)
- THEN:
Ɗ - last three links as a monad:
⁾[] "[]"
j - joined by:
Œt - title case the part
- ELSE:
¹ - the part itsef (¹ is the identity atom)
T[I][N]
不是[T][I][N]
因为T不是元素。我的问题(可能还有拉萨尔的问题)是:我们是否仅需给出1。仅输出元素取代的最大数量?2.只有最小的浪费量?(带有氢原子的HeHe表示答案是否定的。)3.匹配完全耗尽的所有输出?(在这种情况下T[I][N]
,以及T[In]
将是有效的。)我认为正确的解释是3