Find Jobs
Hire Freelancers

C++ project

₹600-1500 INR

Terminado
Publicado hace casi 5 años

₹600-1500 INR

Pagado a la entrega
This problem is based on the classic puzzle of how you can measure out a specific amount of water using buckets of different sizes and a hose. Initially, all of the buckets are empty, and at each point, the only legal moves are: filling up a bucket, dumping out a bucket, or transferring the water in one bucket into another. Note that a transfer will either empty out the bucket it is pouring from or fill up the bucket it is pouring into, whichever happens first. For example, suppose you want to measure out 4 gallons of water using a 3-gallon bucket and a 5-gallon bucket. You might fill up the 5-gallon bucket (5 gal, 0 gal), transfer the 3 gallons to the 3-gallon bucket (2 gal, 3 gal), dump the 3-gallon bucket (2 gal, 0 gal), transfer 2 gallons to the 3-gallon bucket (0 gal, 2 gal), fill the 5-gallon bucket again (5 gal, 2 gal), transfer 1 gallon to the 3-gallon bucket (4 gal, 3 gal), and finally dump the 3-gallon bucket (4 gal, 0 gal). This is the most efficient solution, which takes 7 moves. This program is a twist on the original problem. Instead of describing how to make a given amount of water, your problem is to identify the amount of water that takes the most moves to make. The amount of water in a given set of buckets is the sum of the water in all buckets. In the previous example, the two buckets can have from 0 up to 8 gallons of water between them, and 4 gallons takes the greatest number of moves to make. Input: The program should read its input from the file [login to view URL], in the following format. The first line of the input has one positive integer, n, representing the number of buckets. The next linecontains n positive integers, representing the size of each bucket. The bucket sizes will be given indecreasing order. The number and size of the buckets will be such that your graph will never have more than 1 million vertices or 10 million edges Output: The program should write its output to the file [login to view URL], in the following format. You should write one line with 4 positive integers, separated by spaces. The first two integers will be the number of vertices and the number of edges in the graph,respectively. Note: these numbers should be the number of vertices and edges in the entire graph. The third and fourth integers should be the most difficult amount of water to make and the number of moves that amount takes, respectively. If there is a tie for the amount that takes the greatest number of moves, output the smallest amount of water that takes this many moves. Deliverables input sample: 2 5 3 output sample: 24 106 4 7 input sample: 2 999 998 output sample: 999000 5986006 499 1995 input sample: 4 43 19 7 3 output sample: 28160 465696 2 7
ID del proyecto: 19323088

Información sobre el proyecto

3 propuestas
Proyecto remoto
Activo hace 5 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
Hi, I have rich experience of C++ programming. I have done job as same as your requirement before. I checked your requirement. I'm sure that I can easily do this project. I will do my best for you. best regards.
₹7.000 INR en 2 días
5,0 (31 comentarios)
5,2
5,2
3 freelancers están ofertando un promedio de ₹3.917 INR por este trabajo
Avatar del usuario
Dear sir. Thank you for giving me this opportunity to bid on your project. I read your job requirement and wish I can work on your project. I've a rich experience in the developments with c, c++ and c# and you can check my skills directly. I never disappoint clients and their benefits come first. I provide qualified and trustworthy long-term service. Hope you contact me to discuss more in detail on your project. Thanks and regards
₹3.500 INR en 1 día
5,0 (5 comentarios)
3,8
3,8
Avatar del usuario
Complete solution with an efficient algorithm so that it passes large test cases. Comments will be included if required
₹1.250 INR en 2 días
5,0 (1 comentario)
0,5
0,5

Sobre este cliente

Bandera de INDIA
Hyderabad, India
4,7
15
Forma de pago verificada
Miembro desde may 12, 2015

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.