Easter Sunday P32323


Statement
 

pdf   zip

html

Write a program that prints which day is Easter Sunday of a given year (remember that Easter Sunday is a mobile holiday that corresponds to the first Sunday after the first full moon of the spring.

To solve this problem, use the Gauss method. The Gauss method to find the day (D) and the month (M) that corresponds to the Easter Sunday of a year (Y) is:

  • Is computed (div indicates integer division and mod indicates the remainder of the integer division):
    1. k := Y div 100
    2. y := Y  mod  19
    3. b := Y  mod  4
    4. c := Y  mod  7
    5. q := k div 4
    6. p := (13+8k) div 25
    7. m := (15−p+kq)  mod  30
    8. d := (19y + m)  mod  30
    9. n := (4+kq)  mod  7
    10. e := (2b+4c+6d+n)  mod 7
  • When d+e ≤ 9, then D := 22+d+e and M := 3.
  • When d=29 and e=6, then D := 19 and M := 4.
  • When d=28 and e=6 and y>10, then D := 18 and M := 4.
  • Otherwise, D := d+e−9 and M := 4.

Input

Input is a year (integer number) between 1800 and 9999.

Output

The output is two integer numbers in a line, separated by a slash. The first is the day and the second is the month which correspond to the Easter Sunday of the given year using Gauss method.

Public test cases
  • Input

    2006
    

    Output

    16/4
    
  • Input

    1999
    

    Output

    4/4
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Pascal
    User solutions
    C++