csansoon

P2.16 P35547 Easter Sundays

Sep 26th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int Y,M,D;
  6.     while (cin >> Y) {
  7.         int k = (Y/100);
  8.         int x = (Y%19);
  9.         int b = (Y%4);
  10.         int c = (Y%7);
  11.         int q = (k/4);
  12.         int p = ((13+(8*k))/25);
  13.         int y = ((15-p+k-q)%30);
  14.         int z = (((19*x)+y)%30);
  15.         int n = ((4+k-q)%7);
  16.         int e = (((2*b)+(4*c)+(6*z)+n)%7);
  17.        
  18.         if ((z+e)<=9) {
  19.             D = (22+z+e);
  20.             M = 3;}
  21.         else if (z==29 && e==6) {
  22.             D = 19;
  23.             M = 4;}
  24.         else if (z==28 && e==6 && x>10) {
  25.             D = 18;
  26.             M = 4;}
  27.         else {
  28.             D = (z+e-9);
  29.             M = 4;}
  30.        
  31.         cout << D << "/" << M << endl;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment