Documente Academic
Documente Profesional
Documente Cultură
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace subsetSum
{
class Program
{
static int size;
static int posicao;
static void Main(string[] args)
{
Primeiro();
}
//-------------------------------------------------------------
double[,] teste = {
{176 ,8407 ,750},
{27 ,7959 ,1150.01},
{31 ,7959 ,1189},
{138 ,8273 ,1208.86},
{175 ,8407 ,1303.56},
{172 ,8363 ,1850},
{170 ,8357 ,1885.17},
{29 ,7959 ,2333.31},
{128 ,8024 ,2456.68},
{17 ,7886 ,2574},
{22 ,7958 ,2674.02},
{26 ,7959 ,2674.02},
{150 ,8347 ,2927.45},
{127 ,8007 ,3000},
{135 ,8188 ,3160.86},
{154 ,8355 ,4000},
{11 ,7882 ,4467.58},
{18 ,7886 ,4860.02},
{12 ,7883 ,5000},
{30 ,8007 ,5000},
{153 ,8353 ,5000},
{134 ,8188 ,5839.14},
{147 ,8347 ,6072.55},
{155 ,8357 ,6308.92},
{21 ,7887 ,6325.98},
{132 ,8024 ,6543.32},
{171 ,8363 ,6917.71},
{151 ,8348 ,7000},
{152 ,8349 ,8000},
{15 ,7884 ,8139.8},
{144 ,8273 ,8291.14},
{136 ,8189 ,9000},
{145 ,8311 ,9000},
{146 ,8346 ,9000},
{137 ,8271 ,9776},
{133 ,8187 ,15000}
};
//{ 232.29,
325.98,426,434.2,532.42,546.44,565.98,653.66,664.15,674.02,750,1150.01,1189,1208.86
,1303.56,1850,1885.17,2333.31,2456.68,2574,2674.02,2674.02,
//
2927.45,3000,3160.86,4000,4467.58,4860.02,5000,5000,5000,5839.14,6072.55,6308.92,63
25.98,6543.32,6917.71,7000,8000,8139.8,8291.14,9000,9000,9000,9776,15000,};
soma = teste[posicao,2];
Console.WriteLine("");
Console.WriteLine("PROCURANDO VALORES QUE COMPOEM A SOMA = {0}" + ";
proc " + teste[posicao, 0] + "; adiantamento " + teste[posicao, 1], soma);
EncontrarSubsetSoma();
//------------------------------------------------------------
if (numerosOfSubsetSums == 0)
{
Console.WriteLine("N�o existem subconjuntos com soma desejada.");
Console.ReadKey();
}
}
//-------------------------------------------------------------
double correnteSubsetSum = 0;
Console.Write("($");
for (int i = 0; i < subSetIndexes.Length; i++)
{
Console.Write(set[subSetIndexes[i], 0] + " " +
set[subSetIndexes[i], 1]);
//Console.Write( set[subSetIndexes[i], 1]);
if (i < subSetIndexes.Length - 1)
{
Console.Write(" ,$");
}
Console.WriteLine(")");
remove();
Console.ReadKey();
posicao++;
Primeiro();
if (posicao == 45)
{
System.Environment.Exit(0);
}
}
}
escritor.Close();
saida.Close();
//-------------------------------------------------------------
Console.Write("{");
for (int i = 0; i < arr.GetLength(0); i++)
{
Console.Write(arr[i, 0]);
if (i < arr.Length - 1)
{
Console.Write(" ,");
}
}
Console.WriteLine("}");
}
size++;
}
leitor.Close();
entrada.Close();