编程介的小学生 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 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?