Skip to content

Instantly share code, notes, and snippets.

%append(list1, list2, result)
append([],B,B).
append([H|A],B,[H|T]):-append(A,B,T).
%member(List, Element)
member([X|T],X).
member([Y|T],X):-member(T,X).
%between(start, end, number)
between(A,B,A):- A <= B.
#include <iostream>
#include <fstream>

Поправка на Контролно № 1

Решенията на контролното се предават по e-mail на следния адрес:

kn201317@gmail.com

Задача

Да се напише функция, която със сложност O(N*lgN) намира k-тото по големина нечетно число в масив, разбива го на цифри (числата няма да са с повече от 10 цифри), сортира ги по низходящ ред и връща полученото число от изписването на цифрите.

#include <iostream>
#include <string.h>
using namespace std;
class Label
{
public:
Label(const char* = "", int = 0);
Label(const Label& other);
#include <iostream>
using namespace std;
void mapInt(int (*func)(int), int a[], int n)
{
for (int i = 0; i < n; i++)
{
a[i] = func(a[i]);
}