static public void SolveProblem(TestPlan tp, string outputpath) { int case_no = 1; List <CakeRowsCollections> newCollection = new List <CakeRowsCollections>(); List <string> temp_st_list = new List <string>(); foreach (TestCase tc in tp.lsTestCases) { temp_st_list.Clear(); temp_st_list = tc.lsRowItems; newCollection = UpdateCakeGridColumns(temp_st_list); int invalid_index = CheckForInvalidInitial(GetStringList(newCollection)); while (-1 != CheckForInvalidInitial(GetStringList(newCollection))) { newCollection = UpdateCakeGridRows(GetStringList(newCollection)); } using (StreamWriter wr = new StreamWriter(outputpath, true)) { Console.WriteLine("Case #{0}:", case_no); wr.WriteLine("Case #{0}:", case_no++); foreach (CakeRowsCollections st in newCollection) { wr.WriteLine("{0}", st.modified); //Console.WriteLine("RowID# {0}: Original# {1}: Modified {2}", st.rowid, st.original, st.modified); } } } return; }
static void Main(string[] args) { string path = AppDomain.CurrentDomain.BaseDirectory; string small_input_path = path + @"..\..\A-small-practice.in"; string small_output_path = path + @"..\..\A-small-practice.out"; TestPlan tp_small = new TestPlan(small_input_path); SolveProblem(tp_small, small_output_path); string large_input_path = path + @"..\..\A-large-practice.in"; string large_output_path = path + @"..\..\A-large-practice.out"; TestPlan tp_large = new TestPlan(large_input_path); SolveProblem(tp_large, large_output_path); return; }