private static void FindSolution <T>() where T : IExercise { Type targetType = typeof(T); IExercise exercise = Activator.CreateInstance(targetType) as IExercise; exercise.ReadInput(); exercise.Solve(); exercise.PrintResult(); }