GetMaxIntersectionPoints.cs

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	static double GetMaxIntersectionPoints(int N, int M)
	{
		const int Max = 1000;
		if (N <= 0 || M <= 0 || N > Max || M > Max)
		{
			throw new Exception(
				string.Format("Input params should be greater than 0 and less than {0}!", Max));
		}
		
		double result = (N * (N - 1) / 2.0) * (M * (M - 1) / 2.0);
		return result;
	}
	
	public static void Main()
	{
		Console.WriteLine("UniLecs");
		Console.WriteLine(string.Format("Answer = {0}", GetMaxIntersectionPoints(2, 3))); // 3
	}
}
;