名校训练1380: Easy List Operations题解

一天到晚红烧的鱼 算法基础篇 56 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
A list is a sequence of or more elements, expressed in this form: [a 1 , a 2 , a 3 , ... , a n ], where each a i. is or more consecutive digits or lowercase letters. i.e. each list begins with a left square bracket,then zero or more elements separated by a single comma, followed by a right square bracket. There will. In this problem, we use two list operations: append (++) and remove (--).many times in A. If there are many equal elements in A to choose from, remove them from left to right. Your task is to write a calculator, evaluating simple expressions or the form "list1 ++ list2" or "list1 --

A list is a sequence of or more elements, expressed in this form: [a 1 , a 2 , a 3 , ... , a n ], where each a i is or more consecutive digits or lowercase letters. i.e. each list begins with a left square bracket, then zero or more elements separated by a single comma, followed by a right square bracket. There will be no whitespace characters (spaces, TABs etc) within a list. In this problem, we use two list operations: append (++) and remove (--). 1. A ++ B: append elements in B to the end of A. 2. A -- B: remove all the elements in B, from A. If something appears more than once in B, remove it that many times in A. If there are many equal elements in A to choose from, remove them from left to right (until all occurrences are removed, or there is no need to remove more elements). Your task is to write a calculator, evaluating simple expressions or the form "list1 ++ list2" or "list1 -- list2".

名校训练1380: Easy List Operations题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: 名校训练1380: Easy List Operations题解