using System; public class Test { public static void Main() { for(var i = 0; i < 15; i++) Console.WriteLine ("#{0}: actual: {1}, estimated: {2}", i, GetActualCount(i), i * (i - 1) / 2); } static int GetActualCount(int n) { var count = 0; for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) count++; return count; } }
Standard input is empty
#0: actual: 0, estimated: 0 #1: actual: 0, estimated: 0 #2: actual: 1, estimated: 1 #3: actual: 3, estimated: 3 #4: actual: 6, estimated: 6 #5: actual: 10, estimated: 10 #6: actual: 15, estimated: 15 #7: actual: 21, estimated: 21 #8: actual: 28, estimated: 28 #9: actual: 36, estimated: 36 #10: actual: 45, estimated: 45 #11: actual: 55, estimated: 55 #12: actual: 66, estimated: 66 #13: actual: 78, estimated: 78 #14: actual: 91, estimated: 91