diff options
Diffstat (limited to '2025/05/a.py')
| -rw-r--r-- | 2025/05/a.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/2025/05/a.py b/2025/05/a.py index 5fdb11b..b2699ba 100644 --- a/2025/05/a.py +++ b/2025/05/a.py | |||
| @@ -1,6 +1,17 @@ | |||
| 1 | import fileinput | 1 | import fileinput |
| 2 | 2 | ||
| 3 | rang = True | ||
| 4 | ranges = [] | ||
| 5 | s = 0 | ||
| 3 | with fileinput.input() as lines: | 6 | with fileinput.input() as lines: |
| 4 | for line in lines: | 7 | for line in lines: |
| 5 | ... | 8 | if line == '\n': |
| 6 | 9 | rang = False | |
| 10 | elif rang: | ||
| 11 | i = line.find('-') | ||
| 12 | ranges.append((int(line[:i]), int(line[i+1:-1]))) | ||
| 13 | else: | ||
| 14 | x = int(line[:-1]) | ||
| 15 | if any(x >= r[0] and x <= r[1] for r in ranges): | ||
| 16 | s += 1 | ||
| 17 | print(s) | ||
