Ejemplo n.º 1
0
        public ShoppingList ReadNextCase()
        {
            var sl = new ShoppingList();
            var line1 = Console.ReadLine().Split(' ');
            sl.B = GetIntVal(line1[0]);
            sl.W = GetIntVal(line1[1]);
            var line2 = Console.ReadLine().Split(' ');
            sl.X = GetIntVal(line2[0]);
            sl.Y = GetIntVal(line2[1]);
            sl.Z = GetIntVal(line2[2]);

            return sl;
        }
Ejemplo n.º 2
0
        public long ComputeLowestCost(ShoppingList sl)
        {
            long bCost = (sl.B*sl.X);
            long bCostAlt = (sl.B * (sl.Y + sl.Z));
            if (bCostAlt < bCost)
                bCost = bCostAlt;

            long wCost = (sl.W * sl.Y);
            long wCostAlt = (sl.W * (sl.X+ sl.Z));
            if (wCostAlt < wCost)
                wCost = wCostAlt;

            return bCost + wCost;
        }