Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

simeonP1999 avatar simeonP1999 2 Точки

10. SoftUni Course Planning - CSharp-Fundamentals

Здравейте, само 8 тест ми гърми и не мога да си хвана грешката. Някой ако може да хвърли едно око:

https://pastebin.com/AjJ33Kkj

https://judge.softuni.bg/Contests/Compete/Index/1211#9

 

10 .*SoftUni Course Planning

You are tasked to help with the planning of the next Technology Fundamentals course by keeping track of the lessons, that are going to be included in the course, as well as all the exercises for the lessons.

On the first line you will receive the initial schedule of the lessons and the exercises that are going to be a part of the next course, separated by comma and space ", ". But before the course starts, some changes should be made. Until you receive "course start" you will be given some commands to modify the course schedule. The possible commands are:

Add:{lessonTitle} – add the lesson to the end of the schedule, if it does not exist.

Insert:{lessonTitle}:{index} – insert the lesson to the given index, if it does not exist.

Remove:{lessonTitle} – remove the lesson, if it exists.

Swap:{lessonTitle}:{lessonTitle} – change the place of the two lessons, if they exist.

Exercise:{lessonTitle} – add Exercise in the schedule right after the lesson index, if the lesson exists and there is no exercise already, in the following format "{lessonTitle}-Exercise". If the lesson doesn`t exist, add the lesson in the end of the course schedule, followed by the Exercise.

Each time you Swap or Remove a lesson, you should do the same with the Exercises, if there are any, which follow the lessons.

Input / Constraints

  • first line – the initial schedule lessons – strings, separated by comma and space ", "
  • until "course start" you will receive commands in the format described above

Output

  • Print the whole course schedule, each lesson on a new line with its number(index) in the schedule:
    "{lesson index}.{lessonTitle}"
  • Allowed working time / memory: 100ms / 16MB.

Examples

Input

Output

Comment

Data Types, Objects, Lists

Add:Databases

Insert:Arrays:0

Remove:Lists

course start

1.Arrays

2.Data Types

3.Objects

4.Databases

 

We receive the initial schedule.

Next, we add Databases lesson, because it doesn`t exist.

We Insert at the given index lesson Arrays, because its not present in the schedule.

After receiving the last command and removing lesson Lists, we print the whole schedule.

Input

Output

Comment

Arrays, Lists, Methods

Swap:Arrays:Methods

Exercise:Databases

Swap:Lists:Databases

Insert:Arrays:0

course start

1.Methods

2.Databases

3.Databases-Exercise

4.Arrays

5.Lists

We swap the given lessons, because both exist.

After receiving the Exercise command, we see that such lesson doesn`t exist, so we add the lesson at the end, followed by the exercise.

We swap Lists and Databases lessons, the

Databases-Exercise is also moved after the Databases lesson.

We skip the next command, because we already have such lesson in our schedule.

Тагове:
0
Fundamentals Module
MartinBG avatar MartinBG 4803 Точки
Best Answer

Променете ред №97 на:

else if (!Exist(schedule, $"{lesonTittle}-Exercise"))

Без тази проверка ще се добавя нов урок и упражнение към него ако вече ги има и двата в списъка.

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.