Задание №1: Создать Web-страницу, знакомящую вас с основными тэгами HTML.
10. Замените общие фразы следующими (подумайте какие заменить):
Моя личная страница.
Давайте познакомимся.
Немного о себе:
Моё имя…
Мой адрес…
Контактные координаты…
До встречи за внимание.
198
293
Ответы на вопрос:
#include < iostream> #include < map> #include < vector> using namespace std; map< pair< int, int> , int> saved_rec; map< int, pair< int, int> > path; int max_cost(const vector< int> & cost, int day, int length) { if (day + 1 < length) length = day + 1; if (saved_rec[make_pair(day, length)] ! = 0) return saved_rec[make_pair(day, length)]; int tmp_cost, max = cost[day] * length, max_i = length; if (day ! = 0) for (int i = 0; i < = length; ++i) { tmp_cost = max_cost(cost, day - 1, length-i) + cost[day] * i; if (tmp_cost > max) { max = tmp_cost; max_i = i; } } saved_rec[make_pair(day, length)] = max; if (max_i ! = 0) path[max] = make_pair(day, max_i); return max; } int main() { vector< int> cost = { 6, 2, 5, 4, 5, 3, 3, 4}; int last_day_num = cost.size() - 1, total_length = cost. max; max = max_cost(cost, last_day_num, total_length); cout < < "max profit: " < < max < < endl; pair< int, int> day_count; int sm = 0; do { day_count = path[max]; cout < < "day: " < < day_count.first < < ", length: " < < day_count.second < < endl; max -= cost[day_count.first] * day_count.second; } while (max ! = 0); }
Популярно: Информатика
-
Krupenyapolina08.08.2020 00:51
-
pohta00000029.08.2020 16:57
-
Franikforever7906.06.2020 23:16
-
jiyan27.01.2023 00:45
-
vaniafc00709.10.2021 15:23
-
Elka2967731.01.2022 07:44
-
alex2007serg25.04.2020 01:05
-
Kristinkasssd00129.09.2020 03:10
-
Pizetiv4ik01.05.2021 01:45
-
nickieivanov13.07.2020 15:50