logo AlgoBeat OnlineJudge
登录 注册

#214718. [NWRRC 2025] Compact Encoding

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Binary formats often use compact representations for integers. Consider writing a 32-bit unsigned integer to a file: you must always reserve 4 bytes to represent it (remember, 8 bits make one byte). However, in many real-life applications, integer values tend to be small. Writing these small values using a fixed 4-byte representation results in files that are mostly filled with zero bytes.

To make the representation more compact, we introduce the following encoding scheme. Each value is represented as a sequence of bytes , where each is an integer between and , inclusive. The most significant bit of each byte serves as a continuation flag, and the lower bits carry the actual data. If the continuation flag is , more bytes follow; for the last byte, it is . The representation is , meaning that contains the most significant bits of the encoded value.

For example, here's how to find the compact representation of . First, we find its binary representation:

Next, we split it into 7-bit chunks, padding with zeros on the left if necessary:

:::align{center} / / :::

The first two chunks have a following chunk, so the corresponding bytes have their most significant bit set to . The last chunk has no following chunk, so its most significant bit is . This gives us:

You are given an integer , and your task is to find its compact representation.

输入格式

The only line contains a single integer ().

输出格式

Print a sequence of integers between and , inclusive, representing the compact encoding of . The encoding must not contain leading bytes with zero data bits: that is, it may not start with .

样例

样例输入 1

112025

样例输出 1

134 235 25

样例输入 2

128

样例输出 2

129 0

样例输入 3

0

样例输出 3

0

样例输入 4

42

样例输出 4

42

样例输入 5

16384

样例输出 5

129 128 0

样例输入 6

2147483647 

样例输出 6

135 255 255 255 127