fork(1) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. for(var i = 0; i < 15; i++)
  8. Console.WriteLine ("#{0}: actual: {1}, estimated: {2}",
  9. i,
  10. GetActualCount(i),
  11. i * (i + 1) * (i + 2) / 6);
  12. }
  13.  
  14. static int GetActualCount(int n) {
  15. var count = 0;
  16.  
  17. for (int i = 0; i < n; i++)
  18. for (int j = 0; j <= i; j++)
  19. for (int k = 0; k <= j; k++)
  20.  
  21. count++;
  22.  
  23. return count;
  24. }
  25. }
Success #stdin #stdout 0.03s 33928KB
stdin
Standard input is empty
stdout
#0: actual: 0, estimated: 0
#1: actual: 1, estimated: 1
#2: actual: 4, estimated: 4
#3: actual: 10, estimated: 10
#4: actual: 20, estimated: 20
#5: actual: 35, estimated: 35
#6: actual: 56, estimated: 56
#7: actual: 84, estimated: 84
#8: actual: 120, estimated: 120
#9: actual: 165, estimated: 165
#10: actual: 220, estimated: 220
#11: actual: 286, estimated: 286
#12: actual: 364, estimated: 364
#13: actual: 455, estimated: 455
#14: actual: 560, estimated: 560