编程介的小学生 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 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算