using System.Collections.Generic;
public static double FindLowestDiscountPrice(List<List<string>> pro, List<List<string>> disc)
for (int i = 0; i < pro.Count; i++)
float price = Convert.ToSingle(pro[i][0]);
double min_price = price;
for (int j = 1; j <= pro[i].Count - 1; j++)
if (pro[i][j] == "EMPTY")
double curr_price = price;
int index = disc.FindIndex(r => r.Any(x => x.Equals(tag)));
if (disc[index][1] == "0")
curr_price = Math.Round(Convert.ToSingle(disc[index][2]));
else if (disc[index][1] == "1")
curr_price = Math.Round(price - price * Convert.ToSingle(disc[index][2]) / 100);
else if (disc[index][1] == "2")
curr_price = Math.Round(price - Convert.ToSingle(disc[index][2]));
min_price = Math.Min(min_price, curr_price);
Console.WriteLine(ex.ToString());
public static void Main(string[] args)
List<List<string>> Product = new List<List<string>>();
for (int i = 0; i < 10000; i++)
Product.Add("10 sale Jan-sale sale".TrimEnd().Split(' ').ToList());
Product.Add("200 sale EMPTY".TrimEnd().Split(' ').ToList());
Product.Add("200 sale" .TrimEnd().Split(' ').ToList());
Product.Add("200 sale2 sale3 EMPTY" .TrimEnd().Split(' ').ToList());
Product.Add("40" .TrimEnd().Split(' ').ToList());
Product.Add("40 Jan-sale4 EMPTY" .TrimEnd().Split(' ').ToList());
List<List<string>> Discount = new List<List<string>>();
for (int j = 0; j < 1000; j++)
Discount.Add("sale 0 10".TrimEnd().Split(' ').ToList());
Discount.Add("Jan-sale 1 10".TrimEnd().Split(' ').ToList());
Discount.Add("Jan-sale2 0 50".TrimEnd().Split(' ').ToList());
Discount.Add("Jan-sale3 2 5".TrimEnd().Split(' ').ToList());
Discount.Add("Jan-sale4 2 30".TrimEnd().Split(' ').ToList());
Discount.Add("Jan-sale5 2 5".TrimEnd().Split(' ').ToList());
double result = Result.FindLowestDiscountPrice(Product, Discount);
Console.WriteLine(result);
Console.WriteLine(ex.ToString());