codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

724A.md (1717B)


      1 Source: https://codeforces.com/problemset/problem/724/A
      2 
      3 A. Checking the Calendar
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given names of two days of the week.
     22 
     23 Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year.
     24 
     25 In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31.
     26 
     27 Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday".
     28 
     29 Input
     30 
     31 The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday".
     32 
     33 Output
     34 
     35 Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes).
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 monday  
     43 tuesday
     44 ```
     45 
     46 Output
     47 
     48 ```
     49 NO
     50 ```
     51 
     52 Input
     53 
     54 ```
     55 sunday  
     56 sunday
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 YES
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 saturday  
     69 tuesday
     70 ```
     71 
     72 Output
     73 
     74 ```
     75 YES
     76 ```
     77 
     78 Note
     79 
     80 In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays.
     81 
     82 In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday.