-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.py
More file actions
63 lines (49 loc) · 842 Bytes
/
Copy path1.py
File metadata and controls
63 lines (49 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import math
from collections import *
from itertools import *
from heapq import *
from tqdm import tqdm
import re
PROD = """
wow
"""
TEST = """
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82
"""
x = TEST
x = PROD
x = x.strip()
# Data in differnt formats for quick access
text = x
lines = x.split("\n")
# grid = [list(line) for line in lines]
# dial goes up to 99, then goes back to 0
# 0 - 1 goes to 99
start = 50
# how many times zeor
result = 0
for line in lines:
direction = line[0]
amount = int(line[1:])
for i in range(amount):
if direction == "R":
start += 1
if start > 99:
start = 0
elif direction == "L":
start -= 1
if start < 0:
start = 99
if start == 0:
result += 1
print(start)
print(result)