We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae14cfc commit 223b0baCopy full SHA for 223b0ba
アルゴリズム実技検定 過去問/第10回 アルゴリズム実技検定 過去問/E - 良い日付.py
@@ -24,18 +24,14 @@ def good_date(s: str) -> str:
24
starting_year = eval(s + ' // 10000')
25
26
for yyyy in range(starting_year, 3001):
27
- for mm in range(2, 13):
28
- for dd in range(1, 23):
29
-
+ for mm in range(1, 13):
+ for dd in range(1, 31):
30
date = str(yyyy) + f"{mm:02}" + f"{dd:02}"
31
32
- if len(set(date)) != 2: # skip if the length of set(date) is not uniquely 2
33
- continue
34
35
- if s <= date:
+ if len(set(date)) == 2 and int(s) <= int(date):
36
return date[:4] + "/" + date[4:6] + "/" + date[6:]
37
38
39
if __name__ == '__main__':
40
- S = str(input())
+ S = input()
41
print(Solution.good_date(S))
0 commit comments