fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. // your code goes here
  8. for (int i = 1989; i <= 2000; i ++)
  9. {
  10. Console.WriteLine("{0}\t{1}", i, getLeap(i));
  11. }
  12. for (int i = 2000; i <= 3000; i += 100)
  13. {
  14. Console.WriteLine("{0}\t{1}", i, getLeap(i));
  15. }
  16. }
  17.  
  18. static int getLeap(int y)
  19. {
  20. return (1 - (y % 4 + 2) % (y % 4 + 1)) * ((y % 100 + 2) % (y % 100 + 1)) + (1 - (y % 400 + 2) % (y % 400 + 1));
  21. }
  22. }
Success #stdin #stdout 0.04s 24120KB
stdin
Standard input is empty
stdout
1989	0
1990	0
1991	0
1992	1
1993	0
1994	0
1995	0
1996	1
1997	0
1998	0
1999	0
2000	1
2000	1
2100	0
2200	0
2300	0
2400	1
2500	0
2600	0
2700	0
2800	1
2900	0
3000	0