예제 #1
0
        public void ProblemsRating()
        {
            var api         = new ApiClient();
            var repo        = new ProblemsRepo();
            var snapshot    = api.GetLastSnapshot();
            var totalConvex = 0.0;

            foreach (var p in snapshot.Problems.OrderByDescending(p => p.ExpectedScore()))
            {
                var spec          = repo.Find(p.Id);
                var expectedScore = p.ExpectedScore();
                var convex        = spec == null ? null : (spec.Polygons.Length == 1 && spec.Polygons[0].IsConvex() && spec.Polygons[0].GetSignedSquare() > 0).ToString();
                Console.WriteLine($"id={p.Id} size={p.SolutionSize} expected={expectedScore} isconvex={convex ?? "Unknown"}");
                if (convex != null)
                {
                    totalConvex += expectedScore;
                }
            }
            Console.WriteLine($"Total convex: {totalConvex}");
        }