fork(15) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. for (int i = 1; i <= 12; i++)
  8. {
  9. Console.Write("{0} ", getNumberOfDays(i, 2000));
  10. }
  11. }
  12.  
  13. public static int getNumberOfDays(int m, int y)
  14. {
  15. int leap = (1 - (y % 4 + 2) % (y % 4 + 1)) * ((y % 100 + 2) % (y % 100 + 1)) + (1 - (y % 400 + 2) % (y % 400 + 1));
  16.  
  17. return 28 + ((m + (m / 8)) % 2) + 2 % m + ((1 + leap) / m) + (1/m) - (leap/m);
  18. }
  19. }
Success #stdin #stdout 0.03s 24160KB
stdin
Standard input is empty
stdout
31 29 31 30 31 30 31 31 30 31 30 31