编程介的小学生 2017-04-20 09:23 采纳率: 20.5%
浏览 832
已采纳

Array Slicing

Array slicing is an operation that extracts certain elements from an array and packages them as another array. Now you're asked to implements the array slicing operations for a new programming language -- eggache* (pronounced "eggache star"). The grammar of array slicing in eggache* is:
[ begin : end ] = x1, x2, ..., xk, ...

where begin ≤ end are indices indicating the range of slice. Redundant whitespaces should be ignored. For each operation, the original slice should be printed first, then these elements will be replaced with the new elements provided. See sample for more details.
Input

There is only one case for this problem, which contains about 50 lines of array slicing operations. It's guaranteed that all operations are valid and the absolute values of all integers never exceed 100. The array is empty ([]) before the first operation.

Output

The output produced by array slicing operations in the eggache* programming language.

Sample Input

[ 0 : 0] = 1 2 3 4 5 6 7 8 9
[ 1 : 1] = -1
[ 1 : 1] =
[ 0 : 8] = 9 8 7 6 5 4 3 2 1
[ 2 : 8] = -2, -3, -5, -7
[ 0 : 9] = 000
[ 0 : 1] = 1, 2, 8
[ 2 : 2] = 4
[ 0 : 4] =
Sample Output

1, -1, 2, 3, 4, 5, 6, 7
7, 6, 5, 4, 3, 2
9, 8, -2, -3, -5, -7, 1, 8, 9
0

1, 2, 4, 8

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-05-05 04:17
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求.net core 几款免费的pdf编辑器
  • ¥20 SQL server表计算问题
  • ¥15 C# P/Invoke的效率问题
  • ¥20 thinkphp适配人大金仓问题
  • ¥20 Oracle替换.dbf文件后无法连接,如何解决?(相关搜索:数据库|死循环)
  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)