Skip to content

Commit 223b0ba

Browse files
committed
Update code structure
1 parent ae14cfc commit 223b0ba

File tree

1 file changed

+4
-8
lines changed
  • アルゴリズム実技検定 過去問/第10回 アルゴリズム実技検定 過去問

1 file changed

+4
-8
lines changed

アルゴリズム実技検定 過去問/第10回 アルゴリズム実技検定 過去問/E - 良い日付.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,14 @@ def good_date(s: str) -> str:
2424
starting_year = eval(s + ' // 10000')
2525

2626
for yyyy in range(starting_year, 3001):
27-
for mm in range(2, 13):
28-
for dd in range(1, 23):
29-
27+
for mm in range(1, 13):
28+
for dd in range(1, 31):
3029
date = str(yyyy) + f"{mm:02}" + f"{dd:02}"
3130

32-
if len(set(date)) != 2: # skip if the length of set(date) is not uniquely 2
33-
continue
34-
35-
if s <= date:
31+
if len(set(date)) == 2 and int(s) <= int(date):
3632
return date[:4] + "/" + date[4:6] + "/" + date[6:]
3733

3834

3935
if __name__ == '__main__':
40-
S = str(input())
36+
S = input()
4137
print(Solution.good_date(S))

0 commit comments

Comments
 (0)