Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

The symmetry of months

Introduction

Some months are completely symmetric, meaning they have central symmetry as well as reflection symmetry, like February of 2010:

 February 2010
┌──┬──┬──┬──┬──┬──┬──┐ 
│ │ │ │ │ │ │ │ 
├──┼──┼──┼──┼──┼──┼──┤ 
│ │ │ │ │ │ │ │ 
├──┼──┼──┼──┼──┼──┼──┤ 
│ │ │ │ │ │ │ │ 
├──┼──┼──┼──┼──┼──┼──┤ 
│ │ │ │ │ │ │ │ 
└──┴──┴──┴──┴──┴──┴──┘ 

Some months have only central symmetry, like February of 1996 or current month, the April of 2018:

 February 1996
 ┌──┬──┬──┬──┐
 │ │ │ │ │
 ┌──┬──┬──┼──┼──┼──┼──┤
 │ │ │ │ │ │ │ │
 ├──┼──┼──┼──┼──┼──┼──┤
 │ │ │ │ │ │ │ │
 ├──┼──┼──┼──┼──┼──┼──┤
 │ │ │ │ │ │ │ │
 ├──┼──┼──┼──┼──┴──┴──┘
 │ │ │ │ │
 └──┴──┴──┴──┘
 April 2018 ┌──┐
 │ │
 ┌──┬──┬──┬──┬──┬──┼──┤
 │ │ │ │ │ │ │ │
 ├──┼──┼──┼──┼──┼──┼──┤
 │ │ │ │ │ │ │ │
 ├──┼──┼──┼──┼──┼──┼──┤
 │ │ │ │ │ │ │ │
 ├──┼──┼──┼──┼──┼──┼──┤
 │ │ │ │ │ │ │ │
 ├──┼──┴──┴──┴──┴──┴──┘
 │ │
 └──┘

And some are asymmetric, like the previous month, the March of 2018:

 March 2018
 ┌──┬──┬──┬──┐
 │ │ │ │ │
┌──┬──┬──┼──┼──┼──┼──┤
│ │ │ │ │ │ │ │
├──┼──┼──┼──┼──┼──┼──┤
│ │ │ │ │ │ │ │
├──┼──┼──┼──┼──┼──┼──┤
│ │ │ │ │ │ │ │
├──┼──┼──┼──┼──┼──┼──┘
│ │ │ │ │ │ │
└──┴──┴──┴──┴──┴──┘

Task

Take an input in form of a date, e.g.:

  • 2018.04
  • 2018.03
  • 2010.02
  • 1996.02

Output the corresponding symmetry, e.g.

  • 2018.04 -> centrally symmetric
  • 2018.03 -> asymmetric
  • 2010.02 -> symmetric
  • 1996.02 -> centrally symmetric

Rules

  • This is code golf, so the smallest number of bytes wins.
  • Standard loopholes are obviously not allowed.
  • Assume that the week starts with Monday (thanks to Angs and Arnauld for suggestion).
  • Consider only years between 1900 and 2100 (inclusive).
  • The input and output formatting rules are permissive, meaning you can use any equivalent format that is native to the language of your choice.
  • Base your solution on the Gregorian calendar.

Answer*

Draft saved
Draft discarded
Cancel
5
  • 3
    \$\begingroup\$ Welcome to the site! You may not assume that input is stored in a variable (such as Y or M), so this is currently a snippet and invalid. If you change the variables to calls to input() however, this will be perfectly fine. \$\endgroup\$ Commented Apr 1, 2018 at 17:45
  • 1
    \$\begingroup\$ @cairdcoinheringaahing Thanks for the welcome! Fixed user input :) \$\endgroup\$ Commented Apr 1, 2018 at 18:11
  • \$\begingroup\$ Welcome! Tweaks for -9 bytes here - all import, unpacked input, _[0]+_[-1]->sum(..) \$\endgroup\$ Commented Apr 2, 2018 at 12:37
  • 1
    \$\begingroup\$ Some tricks to get it down 13 bytes here \$\endgroup\$ Commented Apr 2, 2018 at 13:04
  • 1
    \$\begingroup\$ ...and another byte using Dead Possum's sum trick - here \$\endgroup\$ Commented Apr 2, 2018 at 13:19

AltStyle によって変換されたページ (->オリジナル) /