列表

详情


NC250337. "注意标点符号"

描述

"In computer science and information theory, a Huffman code is a particular type of optimal prefix code that is commonly used for lossless data compression. The process of finding or using such a code proceeds by means of Huffman coding, an algorithm developed by David A. Huffman while he was a Sc.D. student at MIT, and published in the 1952 paper 'A Method for the Construction of Minimum-Redundancy Codes'.

When constructing a Huffman tree, we need to know the constructed character set and the probability of occurrence of each character. A commonly used character set contains 26 English letters(Case insensitive), a pair of mysterious characters gives the frequency of occurrence of each character.

The simplest purpose for Huffman coding is to compress the text segments for network transmission.
You need to build a Huffman tree based on the frequency of each character occurrence, then output the weighted path length(WPL) of this Huffman tree.

Finally, Maplef_ Snow gave a string with an unknown meaning:skvqpzcgxjkszcrq"

输入描述

Nothing.

输出描述

A integer, representing the WPL of the tree, 

示例1

输入:

266400261802547418

输出:

U2FsdGVkX18xUyGDQz0fins4uZYwPhVuSzkW8rBU37O1DEiZPsHy0IyTEsARgIOMqM0Yd7ezFBb2JgROuVQe4A==

说明:

The encryption algorithm for the sample output is: AES(AES($pass,$key),$pass)
(But is it really the sample output that needs decoding?)

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

PHP 解法, 执行用时: 9ms, 内存消耗: 2944K, 提交时间: 2023-04-01 21:34:13

3551

上一题