private static void AnalysisCourseData(string dataStr) { string[] constDataStrs = dataStr.Split(' '); CourseData courseData = new CourseData(int.Parse(constDataStrs[0]), int.Parse(constDataStrs[1])); if (courseDatas.Count <= 0) { courseDatas.Add(courseData); } else { for (int index = 0; index < courseDatas.Count; index++) { if (courseData.ConsumeTime < courseDatas[index].ConsumeTime) { courseDatas.Insert(index, courseData); break; } else if (index == courseDatas.Count - 1) { courseDatas.Add(courseData); break; } } } }
private static void ConsumeTimeAddGrade(CourseData courseData, ref long consumeTime) { if (courseData.CurrentGrade < gradeMax) { courseData.CurrentGrade += 1; consumeTime += courseData.ConsumeTime; if (CheckGradeEnough()) { return; } else { ConsumeTimeAddGrade(courseData, ref consumeTime); } } }