#P1317. 2023.6.2-TikTok春招(澳大利亚区域)-第三题

2023.6.2-TikTok春招(澳大利亚区域)-第三题

3. The day of the week

You are given a date, year month day.Return the weekday of the date.

For clarification: A given year n is a leap year if it fulflls all following conditions:

  1. n is divisible by 4
  2. if n is divisible by 100, it must also be divisible by 400

i.e.

1996 is a leap year // 1996 is divisible by 4

2000 is a leap year // 2000 is divisible by 4, 100 and 400

2100 is a normal year // 2100 is divisible by 4, 100 but not divisible by 400

Assume that this rule has been in use since the start of the year system, e.g. year 4 is considered a leap year for purposes of this question.

Input:

1000<=year<=50001000 <= year <= 5000

1<=month<=121 <= month <= 12

1<=day<=311 <= day <= 31

Output

0<= weekday <= 6

0-6 Representing Monday Tuesday Wednesday Thursday Friday Saturday Sunday

Sample

Sample Case 0

Input

2022 7 30

Output

5