一般的な年はうるう年とどこ年の最初と最後の日が同じ日にあるではない年です。特別な共通今年はうまくとして月曜日に終了し、月曜日にとして始まるものです。
あなたの課題は、入力として年を指定すると、最も近い特別な共通の年を見つけ、それが共通の年である場合にそれ自体を出力するプログラム/関数を作成することです。年がその前の年に近い場合、その次の年が大きい年を出力します。
入力
範囲内でテストする年を表す整数1600 <= x <= 2100
。
出力
最も近い特別な一般年を表す整数。
テストケース
2017 -> 2018
2018 -> 2018
1992 -> 1990
1600 -> 1601
2100 -> 2103
1728 -> 1731 (lies between 1725 and 1731)
ノート
指定された範囲内の54年はすべて、リンクされたWikipediaの記事にすでに表示されています。また、参照用にここで提供します。
1601, 1607, 1618, 1629, 1635, 1646, 1657, 1663, 1674, 1685, 1691
1703, 1714, 1725, 1731, 1742, 1753, 1759, 1770, 1781, 1787, 1798
1810, 1821, 1827, 1838, 1849, 1855, 1866, 1877, 1883, 1894, 1900
1906, 1917, 1923, 1934, 1945, 1951, 1962, 1973, 1979, 1990
2001, 2007, 2018, 2029, 2035, 2046, 2057, 2063, 2074, 2085, 2091
2103 (Needed for 2097 to 2100)
a year that is not a leap year and where the first and last day of the year are on the same day
その定義の2番目の部分は冗長です。うるう年以外のすべての年は、ちょうど52週で1日(365日)で、同じ日に開始および終了します。
6, 11, 11
ます IEは最初の6年後、別の11年後、別の11年後、別の6年後などです