Example #1
0
File: 8.cs Project: qifanyyy/CLCDSA
 IEnumerable <ProblemData> ReadData()
 {
     using (var stream = File.OpenText(DataFileName + ".in"))
     {
         var linenum = int.Parse(stream.ReadLine());
         for (int index = 0; index < linenum; index++)
         {
             yield return(ProblemData.Parse(stream.ReadLine()));
         }
     }
 }
Example #2
0
File: 8.cs Project: qifanyyy/CLCDSA
        public void SolveAndWrite()
        {
            var dataList = ReadData();

            ProblemData.InitData();
            var resultList = dataList.Select(d => d.Calc());

            using (var stream = File.CreateText(DataFileName + ".out"))
            {
                int count = 1;
                foreach (var result in resultList)
                {
                    stream.WriteLine("Case #{0}: {1}", count, result);
                    count++;
                }
            }
        }