Find Jobs
Hire Freelancers

aj

$30-50 USD

Terminado
Publicado hace alrededor de 22 años

$30-50 USD

Pagado a la entrega
Given an integer pair p, the first integer is called [login to view URL] and the second integer is called p.second. Given a set s of integer points, the first-sum is the sum of all the first integers in the set: first-sum(s) = sum([login to view URL]) for all p in s. Similarly, the second-sum is the sum of all the second integers in the set: second-sum(s) = sum([login to view URL]) for all p in s Given a set s of integer points, the difference-sum is the absolute value of the difference between first-sum(s) and second-sum(s); that is difference-sum(s) = | first-sum(s) - second-sum(s) | for the same set s of integer pairs, the total-sum is the sum of the first and sums: total-sum(s) = first-sum(s) + second-sum(s) The Problem Write a procedure that accepts a vector of integer pairs V and an non-negative integer n and returns an n-element subset of the integer pairs S having the following properties: The difference-sum of the returned subset is among the smallest of the difference-sums of all possible n-element subsets of V. That is, if s is the returned subset, then difference-sum(s) <= difference-sum(s) for any n-element subset s' of V If s' is another n-element subset of V having the same difference sum as s, then the total sum s is no smaller than the total sum s'. That is, For any n-element subset s' of V, if difference-sum(s) == difference-sum(s'), then total-sum(s') <= total-sum(s). The prototype for your procedure should be std::vector pick_pairs( const std::vector &, unsigned n); Your procedure returns not the pairs themselves, but the indices of the input vector for the pairs in the subset. If n is greater than the input vector size, your procedure should print an error message and exit. ## Deliverables Complete the project using STL of C++ and should be fully-functional and tested for all input validations working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. ## Platform It should be compiled and tested on Sunsolaris,Unix,Linux with C++ and STL
ID del proyecto: 2844036

Información sobre el proyecto

5 propuestas
Proyecto remoto
Activo hace 22 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
See private message.
$21,25 USD en 14 días
5,0 (47 comentarios)
4,5
4,5
5 freelancers están ofertando un promedio de $29 USD por este trabajo
Avatar del usuario
See private message.
$34 USD en 14 días
4,8 (44 comentarios)
5,4
5,4
Avatar del usuario
See private message.
$38,25 USD en 14 días
4,5 (42 comentarios)
4,6
4,6
Avatar del usuario
See private message.
$42,50 USD en 14 días
4,7 (48 comentarios)
4,3
4,3
Avatar del usuario
See private message.
$8,50 USD en 14 días
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
United States
5,0
5
Miembro desde mar 28, 2002

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.