fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var freq = 0;
  9. for(var first = 100; first <= 999; ++first)
  10. {
  11. var firstSum = first.ToString().Select(x => Convert.ToInt32(x - '0')).ToArray<int>().Sum();
  12. for(var second = 000; second <= 999; ++second)
  13. {
  14. var secondSum = second.ToString().Select(x => Convert.ToInt32(x - '0')).ToArray<int>().Sum();
  15. if (firstSum == secondSum) ++freq;
  16.  
  17. }
  18. }
  19. Console.WriteLine(freq);
  20. }
  21. }
Success #stdin #stdout 0.79s 24000KB
stdin
Standard input is empty
stdout
50412