CF132A.Turing Tape
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to print, using the following method.
The integers of the array are processed one by one, starting from the first. Processing i-th element of the array is done in three steps:
1. The 8-bit binary notation of the ASCII-code of the previous printed character is reversed. When the first element of the array is processed, the result of this step is considered to be 0.
2. The i-th element of the array is subtracted from the result of the previous step modulo 256.
3. The binary notation of the result of the previous step is reversed again to produce ASCII-code of the i-th character to be printed.
You are given the text printed using this method. Restore the array used to produce this text.
INTERCAL 是最早的深奥编程语言之一。它众多怪异特性之一是基于字符的输出方法,称为图灵纸带法(Turing Tape method)。该方法将一个无符号 8 位整数数组转换为待打印的字符序列,具体步骤如下:
数组中的整数按顺序逐个处理,从第一个元素开始。处理数组的第 i 个元素包含以下三个步骤:
-
将前一个已打印字符的 ASCII 码的 8 位二进制表示进行位序反转。当处理数组的第一个元素时,此步结果视为 0。
-
将第 i 个数组元素从上一步的结果中模 256 相减(即计算 (上一步结果−数组第 i 个元素)mod256)。
-
将上一步结果的 8 位二进制表示再次进行位序反转,所得结果即为第 i 个待打印字符的 ASCII 码。
现给出使用该方法打印出的文本,请还原出生成该文本所用的原始数组。
输入格式
The input will consist of a single line text which contains the message printed using the described method. String text will contain between 1 and 100 characters, inclusive. ASCII-code of each character of text will be between 32 (space) and 126 (tilde), inclusive.
输入将仅包含一行字符串 text,该字符串是使用上述方法打印出的消息。字符串 text 的长度为 1 到 100 个字符(含端点)。字符串 text 中每个字符的 ASCII 码值均在 32(空格)到 126(波浪号 ~)之间(含端点)。
输出格式
Output the initial array, which was used to produce text, one integer per line.
输出用于生成 _text_ 的初始数组,每行一个整数。
输入输出样例
输入#1
Hello, World!
输出#1
238 108 112 0 64 194 48 26 244 168 24 16 162
说明/提示
Let's have a closer look at the beginning of the example. The first character is "H" with ASCII-code 72 = 010010002. Its reverse is 000100102 = 18, and this number should become the result of the second step of processing. The result of the first step is considered to be 0, so the first element of the array has to be (0 - 18) mod 256 = 238, where a mod b is the remainder of division of a by b.
让我们更仔细地观察该示例的开头部分。第一个字符是 "H",其 ASCII 码为 72 = 01001000₂。将其二进制表示反转后得到 00010010₂ = 18,该数值应作为处理过程第二步的结果。第一步的结果被定义为 0,因此数组的第一个元素应为 (0 - 18) mod 256 = 238,其中 a mod b 表示 a 除以 b 所得的余数。
输入解题思路,AI测评打分。不知道怎么写?